2024-12-10 17:56:21|Myriagame |source:minecraft skins
When I was playing the world, I found that there were fairy maids everywhere. After clearing the /kill instructions, a lot of brushes were immediately brushed out. These guys are simply breeding in a large number of cockroaches, and anyone must stop them!
I know that there is a organism -generating control module like IN Control, but now that it can be done with Kubejs, there is no need to add another module, right?
<<<<<<<<] = "assh: none;" "> causeEvents.sPawND (e => {{
If (e.entity.type == 'Touhou_little_maid: failry') {{
If (e.entity.Level (). Dimension == 'Aether: the_aether') {
E.cancel
}
}
})
This is an event on the server, so of course, it is placed in the server_scripts folder.
The role of this code is very simple. When the fairy maid is generated, if she is in heaven, she will cancel the incident, so that she will not generate a fairy maid, and it will not work.
Later, when I played Alex's CAVES, I found that the fairy maid will also generate a lot in the original cave. Where is the maid in the dinosaur era?The main world is also prohibited, the previous code is not easy to use now.
<<<<<<<<] = "assh: none;" "> causeEvents.sPawND (e => {{
Let getbiome = () => {
Let POS = New Blockpos (math.floor (e.entity.x), math.floor (e.entity.y), math.floor (e.entity.z)))
Return e.entity.Level (). Getbiome (POS) .unwrap (). GET (). Location ().
}
If (e.entity.type == 'Touhou_little_maid: failry') {{
Let biome = getbiome ()
Let biomeblacklist =/(Alexscaves).*/
If (e.entity.Level (). Dimension == 'Aether: The_aether' || biomeblacklist.test (biome)) {
E.cancel () if (e.player) {
E.Player.tell.
}
}
}
})
The focus of the updated code is the Getbiome function. The principle is very simple, that is, the group system where the entity is located in the level, and then return.It's just that long chain call looks very unknown. The following explains what this string means.
Level () Return a level object;
The getBiome () method returns a Holder object equipped with a Biome object;
The unwrap () method is unpack the Holder back a Either object. There are two elements in the Either object: the left is the resourceKekey object with the Biome object.Either the one on the right ", here is left () to get the left side;
Use left () to get an Optional object, which is a resourceKey object equipped with a Biome object;
Use get () to get the ResourceKey in it;
Use local () to get ResourceLocation;
ResourceLocation is the modid: xxx we often see.
All in all, after a long string of packaging, we finally got the group system when the entity was generated, and then used a regular expression to match. If the matching was successful, or the dimension of the entity is on the blacklist, we stopped it from the blacklist, and it was prevented from the blacklist.Entity generation.
The primitive cave is much cleaner now.
National Service DNF Dark Ni
2025-01-28 09:19:27The new screenshot of the be
2025-01-28 09:18:57The 15th anniversary wallpap
2025-01-28 09:18:273DM Xuanyuan Sinicization Gr
2025-01-28 09:17:57French magazine is the first
2025-01-28 09:17:27The sneak game "Republic" wi
2025-01-28 09:16:57The story between humans and
2025-01-28 09:16:27Capture "Trinity 3: Artifact
2025-01-28 09:15:27Wind direction change "Myste
2025-01-28 09:14:57DICE's new project "Dream" w
2025-01-28 09:14:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:26Master Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25King Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25Guide Minecraft Skins
Minecraft Skins
2024-12-10 04:11:24Dark Knight Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Sparta Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Moncraft Skins of the War
Minecraft Skins
2024-12-10 04:11:22Red Witch Minecraft Skins
Minecraft Skins
2024-12-10 04:11:22Golden Cavaliers Minecraft S
Minecraft Skins
2024-12-10 04:11:22