public NeoPotInFirepitRenderer(ICoreClientAPI capi, ItemStack stack, BlockPos pos, bool isInOutputSlot) { this.capi = capi; this.stack = stack; this.pos = pos; this.isInOutputSlot = isInOutputSlot; BlockCookedContainer potBlock = capi.World.GetBlock(stack.Collectible.CodeWithVariant("type", "cooked")) as BlockCookedContainer; if (isInOutputSlot) { MealMeshCacheFix meshcache = capi.ModLoader.GetModSystem <MealMeshCacheFix>(); MeshData potMesh = meshcache.CreateMealMesh(potBlock.Shape, potBlock.GetCookingRecipe(capi.World, stack), potBlock.GetContents(capi.World, stack), potBlock, new Vec3f(0, 2.5f / 16f, 0)); potRef = capi.Render.UploadMesh(potMesh); } else { MeshData potMesh; capi.Tesselator.TesselateShape(potBlock, capi.Assets.TryGet("shapes/block/clay/pot-opened-empty.json").ToObject <Shape>(), out potMesh); potRef = capi.Render.UploadMesh(potMesh); MeshData lidMesh; capi.Tesselator.TesselateShape(potBlock, capi.Assets.TryGet("shapes/block/clay/pot-part-lid.json").ToObject <Shape>(), out lidMesh); lidRef = capi.Render.UploadMesh(lidMesh); } }
public override void OnBeforeRender(ICoreClientAPI capi, ItemStack itemstack, EnumItemRenderTarget target, ref ItemRenderInfo renderinfo) { if (meshCache == null) { meshCache = capi.ModLoader.GetModSystem <MealMeshCacheFix>(); } MeshRef meshref = meshCache.GetOrCreateMealMeshRef(this.Shape, GetCookingRecipe(capi.World, itemstack), GetContents(capi.World, itemstack), this); if (meshref != null) { renderinfo.ModelRef = meshref; } }
public override void OnBeforeRender(ICoreClientAPI capi, ItemStack itemstack, EnumItemRenderTarget target, ref ItemRenderInfo renderinfo) { if (meshCache == null) { meshCache = capi.ModLoader.GetModSystem <MealMeshCacheFix>(); } CookingRecipe recipe = GetCookingRecipe(capi.World, itemstack); ItemStack[] contents = GetContents(capi.World, itemstack); float yoff = 2.5f; // itemstack.Attributes.GetInt("servings"); MeshRef meshref = meshCache.GetOrCreateMealMeshRef(this.Shape, recipe, contents, this, new Vec3f(0, yoff / 16f, 0)); if (meshref != null) { renderinfo.ModelRef = meshref; } }