コード例 #1
0
        public override void OnBeforeRender(ICoreClientAPI capi, ItemStack itemstack, EnumItemRenderTarget target, ref ItemRenderInfo renderinfo)
        {
            if (meshCache == null)
            {
                meshCache = capi.ModLoader.GetModSystem <MealMeshCache>();
            }

            MeshRef meshref = meshCache.GetOrCreateMealMeshRef(this, this.Shape, GetCookingRecipe(capi.World, itemstack), GetContents(capi.World, itemstack));

            if (meshref != null)
            {
                renderinfo.ModelRef = meshref;
            }
        }
コード例 #2
0
        public override void OnBeforeRender(ICoreClientAPI capi, ItemStack itemstack, EnumItemRenderTarget target, ref ItemRenderInfo renderinfo)
        {
            if (meshCache == null)
            {
                meshCache = capi.ModLoader.GetModSystem <MealMeshCache>();
            }

            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, new Vec3f(0, yoff / 16f, 0));

            if (meshref != null)
            {
                renderinfo.ModelRef = meshref;
            }
        }