Modding partnership

Discussion in 'Mod Discussion' started by Alexiy, Oct 9, 2018.

  1. Golrith

    Golrith Over-Achiever Trusted User

    No. A separate mod that allows you to specify a block in the config to turn into a "spawner" (similar to PE) with same config options on rate of spawn and mob list. Even more amazing if you could configure up to 8 blocks with their own independant rates of spawning and spawn lists.

    An alternative to vanilla mob spawners that can be hidden in plain sight and not affected by light levels.


    In my modpack, I have alien spires spawning around made from a couple of unique blocks, and they have vanilla spawners scattered about them, but it looks bad, and nothing spawns in the day.
     
  2. Alexiy

    Alexiy Well-Known Member

    So, basically, make it possible for specified blocks turn into a custom mob spawner? For example, have a chance of random sand block be replaced by said spawner (without spread ability)?
     
  3. Golrith

    Golrith Over-Achiever Trusted User

    If the config is sand, then all sand becomes the spawner. (naturally you wouldn't do that but use very specific blocks, but that's down to the mod user/pack maker).
    That's assuming of course that existing blocks can be modified like that, otherwise it would be new blocks that inherit the same properties of the target block.

    and yes, no spreading. These are just spawning blocks.
     
  4. ICountFrom0

    ICountFrom0 Forum Addict

    okay, that's cool. I've already got a deal setup with somebody else who's done 3 projects for my modpack, but it's cool that you are doing it.

    Thank you.
     
    Alexiy likes this.
  5. Alexiy

    Alexiy Well-Known Member

    Do you mind if I use my library for this mod?

    I've managed to design a block-based spawning system with a config similar to your example, but I made it in Json - this way you can define unlimited entries, for example:
    Code:
    [
      {
        "minecraft:sand" : {
          "chance": 80,
          "entities": [
            "minecraft:husk",
            "minecraft:sheep"
          ]
        }
    
      },
      {
        "minecraft:grass" : {
          "chance" : 75,
          "entities": [
            "minecraft:ocelot",
            "minecraft:polar_bear"
          ]
        }
      }
    ]
    The system works by choosing a random top-most position in a 80 block radius from the player, checking whether a block there is defined in the config, then rolling rng, and spawning an appropriate mob. Any thoughts?
     
    Last edited: Jan 17, 2019
    Celestialphoenix likes this.
  6. Golrith

    Golrith Over-Achiever Trusted User

    Any thoughts?

    AMAZING!

    Something some people might like is an option to use or ignore light level spawning rules. Adds to the flexibility for themed pack makers
     
  7. Alexiy

    Alexiy Well-Known Member

    A prototype is ready. I added few settings to control the spawning, and added a "max_light" key to Json config which defines the maximum light level for given group of mobs to spawn. Here is an example file:

    Code:
    [
      {
        "minecraft:sand" : {
          "chance": 50,
          "max_light" : 15,
          "entities": [
            "minecraft:husk",
            "minecraft:sheep"
          ]
        }
    
      },
      {
        "minecraft:grass" : {
          "chance" : 15,
          "max_light": 10,
          "entities": [
            "minecraft:ocelot",
            "minecraft:polar_bear"
          ]
        }
      },
      {
        "minecraft:obsidian" : {
          "chance" : 90,
          "entities": [
            "minecraft:witch"
          ]
        }
      },
      {
        "minecraft:stone" : {
          "chance" : 90,
          "entities": ["minecraft:silverfish"]
        }
      }
    ]
    
    "max_light" can be omitted, in this case there won't be a check for light.

    The mod will create a file "positional_spawning.json" on launch. It will be parsed for entries. But - you can have any amount of such Json files, and you can switch to using another one without restarting the game. To do that, change the file name in mod options to desired one.
    I also added a command "ps reparse" - use it when you switch the config file or change the active one.
    Download - https://drive.google.com/open?id=1xeWUZn4aO7ef5Fgjc__wlQIIjn6VYglK
    It will require Satako library.
    Awaiting bug reports... : )
     
    Last edited: Jan 22, 2019
    Golrith likes this.
  8. Golrith

    Golrith Over-Achiever Trusted User

    most likely won't be able to test till the weekend, but what you've explained sounds perfect!
     
    ICountFrom0 likes this.
  9. Alexiy

    Alexiy Well-Known Member

  10. Golrith

    Golrith Over-Achiever Trusted User

    Finally I've been able to test this out.

    Bug report - I can't seem to get it to work :D

    This is my json:

    Code:
    [
      {
      "techguns:slimy" : {
      "chance": 50,
      "entities": [
      "techguns:alienbug",
      "techguns:alienbug",
      "techguns:alienbug",
      "techguns:alienbug",
      "minecraft:spider",
      "minecraft:silverfish",
      "minecraft:slime",
      "minecraft:cave_spider"
      ]
      }
      }
    ]
    
    But when I approach that particular block, nothing happens. Looked through my log, can't see anything relevant.
     
    Last edited: Feb 11, 2019
  11. Alexiy

    Alexiy Well-Known Member

    For performance reasons, the mod doesn't search for blocks specified in the files - it rather takes a random position around the player, then checks if a block in that position is one of specified, then rolls the RNG and spawns mob on success. This means that chance of specified mobs to spawn is proportional to amount of that block around the player. This is solely for avoiding lag, because checking all blocks around the player is more cpu-expensive than selecting a random one.
     
  12. Golrith

    Golrith Over-Achiever Trusted User

    Hmm. I hung around an area with a number of these blocks. I'll try again.
     
  13. Golrith

    Golrith Over-Achiever Trusted User

    Okay. Built a large area of the block I'm using, upped the Entity Limit in the config to match the Polluted Earth config in my pack. Still nothing happening. No spawning :(
     
  14. Alexiy

    Alexiy Well-Known Member

    Hmmm... I will investigate this.
     
    Golrith likes this.
  15. Alexiy

    Alexiy Well-Known Member

    Is there any suspicious output in the console?
     
  16. Golrith

    Golrith Over-Achiever Trusted User

    Nothing that I could see. I eyeballed, and searched for the block name (slimy) and mod name as usually they are referenced in errors.
     
  17. Alexiy

    Alexiy Well-Known Member

    It was my fault, I screwed up my math. Now I changed spawning algorithm, and it works.
    Next version ~
    But if you notice lag during this mod's work, you should decrease the "spawnRadius" variable - the higher it is, the more lag there may be ("can't keep up" messages).
     
    Golrith likes this.
  18. Golrith

    Golrith Over-Achiever Trusted User

    Cool, I'll check it out as soon as I can.
     

Share This Page