public override int GetRandomColor(ICoreClientAPI capi, BlockPos pos, BlockFacing facing) { BlockEntityCookedContainer bem = capi.World.BlockAccessor.GetBlockEntity(pos) as BlockEntityCookedContainer; if (bem == null) { return(base.GetRandomColor(capi, pos, facing)); } ItemStack[] stacks = bem.GetNonEmptyContentStacks(); ItemStack rndStack = stacks[capi.World.Rand.Next(stacks.Length)]; if (capi.World.Rand.NextDouble() < 0.4) { return(capi.BlockTextureAtlas.GetRandomPixel(Textures["ceramic"].Baked.TextureSubId)); } if (rndStack.Class == EnumItemClass.Block) { return(rndStack.Block.GetRandomColor(capi, pos, facing)); } else { return(capi.ItemTextureAtlas.GetRandomPixel(rndStack.Item.FirstTexture.Baked.TextureSubId)); } }
public override ItemStack OnPickBlock(IWorldAccessor world, BlockPos pos) { ItemStack stack = base.OnPickBlock(world, pos); BlockEntityCookedContainer bec = world.BlockAccessor.GetBlockEntity(pos) as BlockEntityCookedContainer; if (bec != null) { ItemStack[] contentStacks = bec.GetNonEmptyContentStacks(); SetContents(bec.RecipeCode, bec.QuantityServings, stack, contentStacks); float temp = contentStacks.Length > 0 ? contentStacks[0].Collectible.GetTemperature(world, contentStacks[0]) : 0; SetTemperature(world, stack, temp, false); } return(stack); }