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; } }