#Disable ALL Structures

173 messages · Page 1 of 1 (latest)

bitter sphinx
#

As far as I can tell, every KubeJS support post on 'disabling structures' is just disabling a select few structures. I want to know if there's a quicker solution to disabling all structures (Vanilla & Modded) from generating in a world than manually changing each individual structure to only generate in a non-existent biome.

And before anyone brings it up - I know about the 'Generate Structures' button in the world tab when creating a new world, but I need all worlds that are created to automatically disable structure generation without needing the player to manually click the 'Generate Structures' button everytime they want to start a new world in this modpack.

(For this post we can disregard the Monster Spawner room's weird spawning behaviour, I already have that one sorted.)

stark lavaBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

signal raptor
#

im pretty sure you can use regex with tag events

#

not sure if this'll work or not js ServerEvents.tags("worldgen/biome", event => { event.removeAll("^minecraft:has_structure/") event.get("^minecraft:has_structure/").removeAll() })

bitter sphinx
#

Should I put it under kubejs/data/minecraft/tags/load? I've not used tags outside of getting them to make other stuff load so I'm still quite new to them

signal raptor
#

this is a tag event, it goes in server scripts

bitter sphinx
#

Oh right, I'm silly

#

Ill try now

signal raptor
#

kk

#

with tag events you have to /reload to see changes

#

also since it's worldgen tags you may also need to log out and back into a world

bitter sphinx
#

Was already logged out, logging in now

#

Didn't work, tried in a new world and reloaded

signal raptor
#

if that doesnt work then try the one i just edited

bitter sphinx
#

Trying now

#

Still doesn't work

signal raptor
#

hmm

#

try it now

#

im bad with regex so have patience lol

#

tizus better suited for this

golden rock
#

do you know how regex works...?

signal raptor
#

yeah but i thought this would work

#

tryna cheese it

#

sec

golden rock
#
ServerEvents.tags('worldgen/biome', e => {
    e.removeAll(/^minecraft:has_structure/)
    e.get(/^minecraft:has_structure/).removeAll()
})
#

not tested

signal raptor
#

oo

bitter sphinx
#

I'll try the bottom one first

golden rock
#

this is also wrong

#

regex isn't a string

signal raptor
#

aight lemme delete it since its wrong lol

golden rock
#
ServerEvents.tags('worldgen/biome', e => {
    e.removeAll(/:.*has_structure/)
    e.get(/:.*has_structure/).removeAll()
})
#

again, not tested

signal raptor
#

like i said im not the guy to go to for regexheh

golden rock
#

try both heh

#

as in, try the first one first - if it doesn't work, try the second one

signal raptor
#

yeah, also instead of creating new worlds just do /reload and look up the structure tag

golden rock
#

if they both don't work, then that's on lio

signal raptor
#

like /locate structure #

signal raptor
bitter sphinx
signal raptor
#

ah kk

#

this is all assuming regex works in tag events

golden rock
#

it should afaik

signal raptor
#

ah kk

bitter sphinx
#

Yea I don't think I need to try the bottom one lmao

golden rock
#

the question is, is the regex correct?

signal raptor
#

i know regex doesnt work in worldgen

#

??kjslogs

peak leafBOT
# signal raptor ??kjslogs

You can find your KubeJS server log in /minecraft/logs/kubejs/server.log.
If you are on 1.18 or below it will be called server.txt.
Please send it if asked, as it contains helpful information.

bitter sphinx
#

Or the bottom one, both spat the same chat error

golden rock
#

??kjslogs

peak leafBOT
# golden rock ??kjslogs

You can find your KubeJS server log in /minecraft/logs/kubejs/server.log.
If you are on 1.18 or below it will be called server.txt.
Please send it if asked, as it contains helpful information.

bitter sphinx
#

And exact same for the 2nd one

golden rock
#

nvm then

signal raptor
bitter sphinx
peak leafBOT
signal raptor
#

oh nvm rec.js#6: Could not create ID from '/:.*has_structure/'!: net.minecraft.ResourceLocationException: Non [a-z0-9_.-] character in namespace of location: /:.*has_structure/

golden rock
#

so ig you can't use regex

signal raptor
#

lol

#

that was for this

#

also the command would be

#

not /locate structure like i said before lol

bitter sphinx
golden rock
#

so it's on lio

bitter sphinx
#

(Also forgot to disable reply pings sorry)

golden rock
golden rock
bitter sphinx
#

Oh right sorry lol

signal raptor
#

'/:.*doom_helmet/', is how i was locating doom helmets in the recipe event tho so wouldnt this also be a string?

warm wolf
#

are you guys 100% sure you can use regex on tag events?

signal raptor
#

got it working

#
ServerEvents.tags('worldgen/biome', e => {
    if (e.type.namespace == 'minecraft' && e.type.path == 'has_structure') {
        e.removeAll();
    }
})```
#

no regex needed

signal raptor
#

@bitter sphinx try this ^

signal raptor
#

so he prob just removes the e.type.namespace

#

i just put it there for the examples sake

bitter sphinx
#

Logging back in to try lol

warm wolf
#

and I hope some other mods follow the standard has_structure

signal raptor
#

make sure you create a new world this time

signal raptor
#

so might have to manually add the weird modded structures

#

or change the type check

warm wolf
#

that is @bitter sphinx problem kek

signal raptor
#

tru

bitter sphinx
#

Worked! At least for Vanilla as you said

signal raptor
#
if (e.type.path == 'has_structure')```
#

nice!

bitter sphinx
#

Just supplementaries and profundis that also add structures so shouldn't be too hard to test w/o the namespace

signal raptor
#

i mean it should work

#

test it out before closing the ticket tho

bitter sphinx
#
ServerEvents.tags('worldgen/biome', e => {
    if (e.type.path == 'has_structure') {
        e.removeAll();
    }
})

Appears to work for vanilla & modded

signal raptor
#

??closeticket

peak leafBOT
# signal raptor ??closeticket

Please close your ticket (with </ticket close:1054771505520717835> or the button atop this thread) once you resolved your issue! This also helps others that would like to help out, as they don't have to look into this thread to check if it has been resolved by now.

Do you have any other questions regarding your issue? Feel free to ask!
Note: You generally should create a new post for unrelated issues.

bitter sphinx
#

Just one final note for anyone in the future - things that aren't removed are the Mineshafts, Ancient Cities, Strongholds, and Monster Dungeons (hard-coded structures)

warm wolf
#

strongholds are removed, i'm 100% sure

#

they use has_structure

#

well, mineshaft should too 😐

signal raptor
#

ancient cities are removed for me

#

you might also have to in an else if statement specify the namespace like before

#
ServerEvents.tags('worldgen/biome', e => {
    if (e.type.path == 'has_structure') {
        e.removeAll();
    }else if (e.type.namespace == 'minecraft' && e.type.path == 'has_structure') {
        e.removeAll();
    }
})```
warm wolf
#

== or contains?

signal raptor
#

should be ==

warm wolf
#

or some sort

signal raptor
#

ancient cities are what i checked matter of fact

#

for the test and they were 100% removed

#

odd

warm wolf
#

@signal raptor can you check if this removeAll removes all tags from worldgen?

#

and not just has_structure

#

I don't remember tags having a loop

#

so you could use e.type 😐

#

that is new to me

warm wolf
# signal raptor it should
ServerEvents.tags("worldgen/biome", event => {
    console.log(event.type)
})

[13:54:56] [INFO] example.js#32: minecraft:worldgen/biome

signal raptor
#

oh

#

what

#

thats if you do "minecraft:worldgen/biome" tho

#

we're doing "worldgen/biome"

bitter sphinx
#

Oh dear. I crashed when it tried to take me to an Ancient City ._.

warm wolf
#

read mine

signal raptor
#

yeah ik

warm wolf
#

i'm worldgen/biome

signal raptor
#

which is why thats weird like wut

golden rock
signal raptor
golden rock
#

it doesn't

signal raptor
#

also didnt the modded ones get removed?

peak leafBOT
#

[Quote ➤](#1179778156505337887 message) ```js
ServerEvents.tags('worldgen/biome', e => {
if (e.type.path == 'has_structure') {
e.removeAll();
}
})

Appears to work for vanilla & modded
bitter sphinx
#

I'm trying again, maybe it was just a fluke...?

bitter sphinx
peak leafBOT
signal raptor
bitter sphinx
#

Started a new world, structures of both vanilla and modded still generating

bitter sphinx
signal raptor
#

send latestlogs

bitter sphinx
peak leafBOT
#

Paste version of server.log from @bitter sphinx

signal raptor
#

what kinda log is that

#

oh server log

#

i meant latest.log

golden rock
#

??mclog

peak leafBOT
# golden rock ??mclog

Please send your Minecraft log. It can be found at ./logs/latest.log.
Note! Minecraft and KubeJS logs differ. Please send the latest.log, not a KubeJS log.

golden rock
bitter sphinx
peak leafBOT
#

Paste version of latest.log from @bitter sphinx

signal raptor
#

also really it should be .remove() instead of removeAll()

#

im testing something out

bitter sphinx
#

Just for the sake of documentation - I did try

ServerEvents.tags('worldgen/biome', e => {
    if (e.type.namespace == 'minecraft' && e.type.path == 'has_structure') {
        e.remove();
    }
})

and it did not work either.

signal raptor
#

yeah for some reason its not working though i have an idea maybe to sift through all the objects though ill be looking at it tomorrow maybe

#

worst case scenario youll have to manually add all the biome tags for has_structure though we'll see

bitter sphinx
#

In the end I've decided to just take the manual route of using a bogstandard datapack of all the structure_set files and just remove the structures from each file, then toss that datapack into kubejs to make it universal for all generated world

#
{
  "placement": {
    "type": "minecraft:random_spread",
    "salt": 34222645,
    "separation": 15,
    "spacing": 40
  },
  "structures": [
    {
      "structure": "minecraft:ruined_portal",
      "weight": 1
    },
    {
      "structure": "minecraft:ruined_portal_desert",
      "weight": 1
    },
    {
      "structure": "minecraft:ruined_portal_jungle",
      "weight": 1
    },
    {
      "structure": "minecraft:ruined_portal_swamp",
      "weight": 1
    },
    {
      "structure": "minecraft:ruined_portal_mountain",
      "weight": 1
    },
    {
      "structure": "minecraft:ruined_portal_ocean",
      "weight": 1
    },
    {
      "structure": "minecraft:ruined_portal_nether",
      "weight": 1
    }
  ]
}

to

{
  "placement": {
    "type": "minecraft:random_spread",
    "salt": 34222645,
    "separation": 15,
    "spacing": 40
  },
  "structures": []
}
#

as an example.

#

To anyone reading this in the future who were hoping to avoid this and instead try automate it with kubejs - sorry!