Jump to content

Vintagebob

Vintarian
  • Posts

    36
  • Joined

  • Last visited

Posts posted by Vintagebob

  1. And instant an other problem, hehe, 😁

     

    I  make a mod, that includes corals to the game, but i cant spawn fishes in the corals! I think, because the corals are rare blocks and the vintagestory-mob-spawning system (maybe) picks out every tick a random block, the chance, that it picks a coral is very very low... even if i turn the spawn rate of the fishes to 1000 000, they do not spawn!

    Can someone help me, pls? : D

  2. Hello, im not a code wizard but something i can code too :D.

    Here is the codefile. It makes, that only the third part of the drifters, which spawn above the Y-Position 100, really spawn. You can open the file with the normal text-editor or a better programm and change the properties. Its written down there, where you must change.

    Dont forget to create a "src" folder next to the assets folder, change your modtype to "code" and change the drifterclass to th class "EntityDrifter".

    I've tested the mod out and even if you spawn a drifter with the spawnitem, there is a chance, that he does'nt spawn. In fact, the naturally spawning and the spawning with the item is the same.

    I hope i could help you, and sorry for my writing mistakes, im not english :D

    Class1.cs

    • Like 2
  3. I asked this allready, but in the wrong forum, now again in the Modding questions 🙂

    Hello, im programming a Vintage Story mod and want do add hydrothermal vents to the game. The block itself works perfectly, but i can't generate these vents under the water :(.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Here is my programm code in the .cs file:

     

    using System;
    using Vintagestory.API.Common;
    using Vintagestory.API.Common.Entities;
    using Vintagestory.API.MathTools;

    namespace omniummod
    {
        public class Omniummod : ModSystem
        {

            public override void Start(ICoreAPI api)
            {
                base.Start(api);
                api.RegisterBlockClass("hydrothermal_vent", typeof(hydrothermal_vent));
            }
        }

        public class hydrothermal_vent : Block
        {
            Random random = new Random();
            Block[] blocks;

            public override bool TryPlaceBlockForWorldGen(IBlockAccessor blockAccessor, BlockPos pos, BlockFacing onBlockFace, LCGRandom worldGenRand)
            {
                BlockPos belowPos = pos.DownCopy();

                Block block = blockAccessor.GetBlock(belowPos);
                if (block.LiquidCode != "water") return false;

                int depth = 1;
                while (depth < 100)
                {
                    belowPos.Down();
                    block = blockAccessor.GetBlock(belowPos);

                    if (block.Fertility >= 0)
                    {
                        belowPos.Up();
                        PlaceVent(blockAccessor, belowPos, depth);
                        return true;
                    }
                    else
                    {
                        if (!block.IsLiquid()) return false;
                    }

                    depth++;
                }

                return false;

            }

            private void PlaceVent(IBlockAccessor blockAccessor, BlockPos pos, int depth)
            {
                int height = Math.Min(depth - 1, 1 + random.Next(3) + random.Next(3));
                AssetLocation assetl = new AssetLocation("omniummod", "blocktypes/deepwaterblocks/hydrothermal_vent");
                blockAccessor.SetBlock(blockAccessor.GetBlock(assetl).BlockId, pos);
            }
        }
    }

    (some parts I copied from the Seaweed class :D)

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Here is the .json file of the hydrothermal vent, if the problem ist not in the code but in the block:

    {
        code: "hydrothermal_vent",
        entityClass: "hydrothermal_vent",    
        creativeinventory: { "general": ["*"] },
        blockmaterial: "Stone",
        drawtype: "json",
        shape: { 
            base: "block/deepwaterblocks/hydrothermal_vent*",
        },
        storageFlags: 257,        
        lightAbsorption: 0,
        sidesolid: {
            all: "false"
        },
        sideopaque: {
            all: "false"
        },
        resistance: 2.0,
        sounds: {
            "place": "game:block/stone",
            "walk": "game:block/stone"
        },
        particleProperties: [
            {
                hsvaColor: [{ avg: 0, var: 1 }, { avg: 0, var: 1 }, { avg: 0, var: 1 },  { avg: 0, var: 1 }],
                gravityEffect: { avg: -0.02, var: 0.01 },
                posOffset: [ { avg: 0, var: 0.1 }, { avg: 0.5, var: 0.1 }, { avg: 0, var: 0.1 }],
                velocity: [ { avg: 0, var: 0.25 }, { avg: 0.1, var: 0.1 }, { avg: 0, var: 0.25 }],
                quantity: { avg: 1, var: 1 },
                size: { avg: 5, var: 1 },
                sizeEvolve: { transform: "quadratic", factor: 0.5 },
                lifeLength: { avg: 3, var: 1 },
                vertexFlags: 128
            }
        ],
        guiTransform: {
            rotation: { x: -22.6, y: -145, z: 0 }
        },
        tpHandTransform: {
            translation: { x: -2.1, y: -1.4, z: -1.5 },
            rotation: { x: 0, y: 17, z: -88 }
        },
        groundTransform: {
            translation: { x: 0, y: 0, z: 0 },
            rotation: { x: -58, y: -45, z: 0 },
            origin: { x: 0.5, y: 0, z: 0.5 },
            scale: 1.5
        }
    }

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    And here is the .json worldgen file, where I make the hydrothermal vent - blockpatch:

    {
        chanceMultiplier: { dist: "uniform", avg: 2.5, var: 2 },
        patches: [
            {
                comment: "Large patches of hydrothermal vent",
                blockCodes: ["hydrothermal_vent"],
                quantity: { avg: 25, var: 15 },
                offsetX: { avg: 0, var: 12 },
                offsetZ: { avg: 0, var: 12 },
                chance: 1,
                minWaterDepth: 1,
                placement: "UnderWater"
            },
        ]
    }

     

    its copied from the Seaweed blockpatch...

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    I hope someone will be able to help me

    and thank you in advance :D

  4. Hello, im programming a Vintage Story mod and want do add hydrothermal vents to the game. The block itself works perfectly, but i can't generate these vents under the water :(.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Here is my programm code in the .cs file:

     

    using System;
    using Vintagestory.API.Common;
    using Vintagestory.API.Common.Entities;
    using Vintagestory.API.MathTools;

    namespace omniummod
    {
        public class Omniummod : ModSystem
        {

            public override void Start(ICoreAPI api)
            {
                base.Start(api);
                api.RegisterBlockClass("hydrothermal_vent", typeof(hydrothermal_vent));
            }
        }

        public class hydrothermal_vent : Block
        {
            Random random = new Random();
            Block[] blocks;

            public override bool TryPlaceBlockForWorldGen(IBlockAccessor blockAccessor, BlockPos pos, BlockFacing onBlockFace, LCGRandom worldGenRand)
            {
                BlockPos belowPos = pos.DownCopy();

                Block block = blockAccessor.GetBlock(belowPos);
                if (block.LiquidCode != "water") return false;

                int depth = 1;
                while (depth < 100)
                {
                    belowPos.Down();
                    block = blockAccessor.GetBlock(belowPos);

                    if (block.Fertility >= 0)
                    {
                        belowPos.Up();
                        PlaceVent(blockAccessor, belowPos, depth);
                        return true;
                    }
                    else
                    {
                        if (!block.IsLiquid()) return false;
                    }

                    depth++;
                }

                return false;

            }

            private void PlaceVent(IBlockAccessor blockAccessor, BlockPos pos, int depth)
            {
                int height = Math.Min(depth - 1, 1 + random.Next(3) + random.Next(3));
                AssetLocation assetl = new AssetLocation("omniummod", "blocktypes/deepwaterblocks/hydrothermal_vent");
                blockAccessor.SetBlock(blockAccessor.GetBlock(assetl).BlockId, pos);
            }
        }
    }

    (some parts I copied from the Seaweed class :D)

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Here is the .json file of the hydrothermal vent, if the problem ist not in the code but in the block:

    {
        code: "hydrothermal_vent",
        entityClass: "hydrothermal_vent",    
        creativeinventory: { "general": ["*"] },
        blockmaterial: "Stone",
        drawtype: "json",
        shape: { 
            base: "block/deepwaterblocks/hydrothermal_vent*",
        },
        storageFlags: 257,        
        lightAbsorption: 0,
        sidesolid: {
            all: "false"
        },
        sideopaque: {
            all: "false"
        },
        resistance: 2.0,
        sounds: {
            "place": "game:block/stone",
            "walk": "game:block/stone"
        },
        particleProperties: [
            {
                hsvaColor: [{ avg: 0, var: 1 }, { avg: 0, var: 1 }, { avg: 0, var: 1 },  { avg: 0, var: 1 }],
                gravityEffect: { avg: -0.02, var: 0.01 },
                posOffset: [ { avg: 0, var: 0.1 }, { avg: 0.5, var: 0.1 }, { avg: 0, var: 0.1 }],
                velocity: [ { avg: 0, var: 0.25 }, { avg: 0.1, var: 0.1 }, { avg: 0, var: 0.25 }],
                quantity: { avg: 1, var: 1 },
                size: { avg: 5, var: 1 },
                sizeEvolve: { transform: "quadratic", factor: 0.5 },
                lifeLength: { avg: 3, var: 1 },
                vertexFlags: 128
            }
        ],
        guiTransform: {
            rotation: { x: -22.6, y: -145, z: 0 }
        },
        tpHandTransform: {
            translation: { x: -2.1, y: -1.4, z: -1.5 },
            rotation: { x: 0, y: 17, z: -88 }
        },
        groundTransform: {
            translation: { x: 0, y: 0, z: 0 },
            rotation: { x: -58, y: -45, z: 0 },
            origin: { x: 0.5, y: 0, z: 0.5 },
            scale: 1.5
        }
    }

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    And here is the .json worldgen file, where I make the hydrothermal vent - blockpatch:

    {
        chanceMultiplier: { dist: "uniform", avg: 2.5, var: 2 },
        patches: [
            {
                comment: "Large patches of hydrothermal vent",
                blockCodes: ["hydrothermal_vent"],
                quantity: { avg: 25, var: 15 },
                offsetX: { avg: 0, var: 12 },
                offsetZ: { avg: 0, var: 12 },
                chance: 1,
                minWaterDepth: 1,
                placement: "UnderWater"
            },
        ]
    }

     

    its copied from the Seaweed blockpatch...

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    I hope someone will be able to help me

    and thank you in advance :D

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.