Started by
Toma400
on
Topic category: Help with Minecraft modding (Java Edition)
As in title: I want to make a block which disables spawning of any typical mob (zombie, skeleton, spider, creeper) when activated, and that should affect only specific area (let's say, 10 blocks in each direction of mentioned block).
It's important that I don't want to make world peaceful, nor despawn any mob that's already in that area (for example, zombie which I tagged to use in iron farm).
Is it possible to do that only by procedures/commands, or should I code something? And if so, can someone explain me the way, like you would explain to total noob?
I'd be so grateful, because I thought that "spawn disablers" would be great as an option for city builders <3
You could make a biome that looks like any default biome and just make it so nothing spawns there, Test that first, but it might not work since I believe that default mob spawning at night is already coded into the game itself. I hope I could help :)
Sadly that's not what I meant :< this would mean I have to redo whole game and all biome-adding mods, and that's still just making everything similar to mushroom biome, which is not great. Because I didn't want specific area to be "mobproof" by default, but only when this mob-blocking block is active.
So, you would decide whether it is affected by that or not - just like beacons with its effect. Whole idea came from lack of that mechanic in vanilla beacons, to be honest.
I imagine solution being that block despawning all entities with specific name (like, "Zombie"), so that would keep safe nametagged ones. But still I don't know how to make that affect specific area and how to trigger it correctly ("on client tick" block trigger would be cool, but that doesn't have "entity in area" dependency).
if you know how to code, block classes have a method called "canEntitySpawn" which determines if a type of entity can spawn on it. all mob's spawning process will call that method to check if spawning allowed.
The point is that I don't know how to code, this is why I mention procedures mainly. But thanks for the tip, if I ever have time for learning such, I will know the way :)
Hello Toma400
Took some research and some fiddling but i've managed to come up with something that just might be the solution.
> Here < is a small demonstration of how it works
> Here < is how it works
In the SS the parts highlighted in red are whats important.
Just tested it, and it works perfectly. With additional procedure I made activated and inactive version of block, and it's exactly as in your video. The only thing remaining about mob's loot still being dropped, but I can live with that, it can even help with mob farms in some sense.
My sir, I am just out of words, thanks for everything! You even gave me precise tutorial and video for that, that's such a generosity. Thanks for making my day, and glowing obsidian a purpose <3
Do you want to have your name in "thank you" list in mod's description? I will gladly do that, if you don't have anything against it ^^
:D No problem, I just really enjoy helping others, especially when I'm stuck on something myself. It also helps me because now I know how to do this as well. As for the thankyou in your mod list thats completely up to you :)