コード例 #1
0
        //RoomRegistry roomreg;

        public override void OnLoaded(ICoreAPI api)
        {
            base.OnLoaded(api);

            if (Code.Path.Contains("sunflower"))
            {
                WaveFlagMinY = 0.1f;
            }
            else
            {
                WaveFlagMinY = 0.5f;
            }

            tickGrowthProbability = Attributes?["tickGrowthProbability"] != null ? Attributes["tickGrowthProbability"].AsFloat(defaultGrowthProbability) : defaultGrowthProbability;

            if (api.Side == EnumAppSide.Client)
            {
                if (this.RandomDrawOffset > 0)
                {
                    JsonObject overrider = Attributes?["overrideRandomDrawOffset"];
                    if (overrider?.Exists == true)
                    {
                        this.RandomDrawOffset = overrider.AsInt(1);
                    }
                }
            }
        }
コード例 #2
0
        private int CurrencyValuePerItem(ItemSlot slot)
        {
            JsonObject obj = slot.Itemstack?.Collectible?.Attributes?["currency"];

            if (obj != null && obj.Exists)
            {
                JsonObject v = obj["value"];
                return(v.Exists ? v.AsInt(0) : 0);
            }
            return(0);
        }
コード例 #3
0
        public override void OnLoaded(ICoreAPI api)
        {
            base.OnLoaded(api);

            ICoreServerAPI sapi = api as ICoreServerAPI;

            if (sapi != null)
            {
                if (Code.Path.Equals("bamboo-grown-green-segment1"))
                {
                    sapi.RegisterTreeGenerator(new AssetLocation("bamboo-grown-green"), this);
                }
                if (Code.Path.Equals("bamboo-grown-brown-segment1"))
                {
                    sapi.RegisterTreeGenerator(new AssetLocation("bamboo-grown-brown"), this);
                }
            }

            if (greenSeg1 == null)
            {
                IBlockAccessor blockAccess = api.World.BlockAccessor;

                greenSeg1 = blockAccess.GetBlock(new AssetLocation("bamboo-grown-green-segment1"));
                greenSeg2 = blockAccess.GetBlock(new AssetLocation("bamboo-grown-green-segment2"));
                greenSeg3 = blockAccess.GetBlock(new AssetLocation("bamboo-grown-green-segment3"));

                brownSeg1 = blockAccess.GetBlock(new AssetLocation("bamboo-grown-brown-segment1"));
                brownSeg2 = blockAccess.GetBlock(new AssetLocation("bamboo-grown-brown-segment2"));
                brownSeg3 = blockAccess.GetBlock(new AssetLocation("bamboo-grown-brown-segment3"));

                brownLeaves = blockAccess.GetBlock(new AssetLocation("bambooleaves-brown-grown"));
                greenLeaves = blockAccess.GetBlock(new AssetLocation("bambooleaves-green-grown"));

                greenShootBlock = blockAccess.GetBlock(new AssetLocation("sapling-greenbambooshoots-free"));
                brownShootBlock = blockAccess.GetBlock(new AssetLocation("sapling-brownbambooshoots-free"));
            }

            if (RandomDrawOffset > 0)
            {
                JsonObject overrider = Attributes?["overrideRandomDrawOffset"];
                if (overrider?.Exists == true)
                {
                    this.RandomDrawOffset = overrider.AsInt(1);
                }
            }

            isSegmentWithLeaves = LastCodePart() == "segment2" || LastCodePart() == "segment3";
        }
コード例 #4
0
ファイル: BlockPlant.cs プロジェクト: curquhart/vssurvivalmod
        public override void OnLoaded(ICoreAPI api)
        {
            base.OnLoaded(api);

            if (api.Side == EnumAppSide.Client)
            {
                snowLayerBlock = api.World.GetBlock(new AssetLocation("snowlayer-1"));
                tallGrassBlock = api.World.GetBlock(new AssetLocation("tallgrass-tall-free"));
                if (this.RandomDrawOffset > 0)
                {
                    JsonObject overrider = Attributes?["overrideRandomDrawOffset"];
                    if (overrider?.Exists == true)
                    {
                        this.RandomDrawOffset = overrider.AsInt(1);
                    }
                }
            }

            WaveFlagMinY = 0.5f;
        }
コード例 #5
0
        public override void OnLoaded(ICoreAPI api)
        {
            base.OnLoaded(api);

            if (api.Side == EnumAppSide.Client)
            {
                snowLayerBlock = api.World.GetBlock(new AssetLocation("snowlayer-1"));
                tallGrassBlock = api.World.GetBlock(new AssetLocation("tallgrass-tall-free"));
                if (this.RandomDrawOffset > 0)
                {
                    JsonObject overrider = Attributes?["overrideRandomDrawOffset"];
                    if (overrider?.Exists == true)
                    {
                        this.RandomDrawOffset = overrider.AsInt(1);
                    }
                }
            }

            climateColorMapping   = EntityClass == "Sapling";
            tallGrassColorMapping = Code.Path == "flower-lilyofthevalley-free";

            ExtraBend = (Attributes?["extraBend"].AsInt(0) ?? 0) << VertexFlags.WindDataBitsPos;
        }