Torchmaster

Torchmaster

117M Downloads

[Bug]: Not blocking Phantom again

Closed this issue · 6 comments

commented

Torchmaster Version

21.1.5-beta

Mod Loader

Neoforge

Mod Loader Version

21.1.200

What happened?

No debug log of phantom spawning.
Image

Image

I am not familiar with the API of 1.21
It seems that duplicate events has been registered in the code.

public static void onCheckSpawn(MobSpawnEvent.PositionCheck event)

public static void onDoSpecialSpawn(MobSpawnEvent.PositionCheck event)

Relevant log output

commented

Thank you for reporting this.
The event is indeed registered twice. There was initially a reason for it, but it shouldnt be there anymore - atleast not the way its done. Thats a mistake on my side.

Phantoms spawning is indeed a bit odd but the fact its not being logged indicates that torchmaster is never receiving a spawn attempt. Phantoms are spawned via the PhantomSpawner class rather than the NaturalSpawner. It seems the PhantomSpawner uses a different event for this purpose.
Do you know if this was working in different versions of Torchmaster? I recall playing a 1.20 world quite extensively without Phantoms spawning, but I dont know if I really stayed up for long enough to trigger it.

I'll look into fixing this.

commented

I have tested it on 1.20 and the thing works fine.

Image
commented

I have tested it on 1.20 and the thing works fine.
Image

Thank you for confirming this. I've made a fix for 1.21.5
I'll backport the fix to earlier 1.21 versions over the next few days, not enough time right now.

The fix is in version 21.5.2 for 1.21.5. I've not uploaded it to curseforge/modrinth yet, I'll do that later today. You can get the version from the github releases in the meantime:
https://github.com/Xalcon/TorchMaster/releases/tag/mc1.21.5-21.5.2-beta

commented

The spawning of patrols may not be blocked either.

In 1.20, blocking information could be clearly found in the debug log.
In 1.21, no such information appears even after waiting for an extended period.

I've debugged it and confirmed that MobSpawnEvent.PositionCheck is not fired during PatrolSpawner#tick.

Not sure if there are alternatives to block the spawning of patrols.

commented

Patrols are a bit harder to check without some major manipulation to its spawner code - but I do agree, it looks like the code was changed in 1.21.x (not sure which exact version).

Patrols seem to be handled by the PatrolSpawner class. Neoforge does not create an event hook for that class, making it currently impossible to block the spawning with Neoforge alone. I'll have to create a mixin for this - which isnt an issue, Fabric will need a Mixin as well.

Generally, patrols seem to have the following requirements:

  • Patrols do not spawn within the first 5 ingame days.
  • After the initial 5 days, a patrol may attempt spawning every day (around midnight?)
  • Can only spawn if a randomly chosen player is near a village
  • The chance for a patrol to spawn each given day is 20%
    All of these conditions reduce the likely hood of a patrol spawning to quite the low chance.
    I'll need to look into where the optimal location for my Mixin is going to be.

Thanks again for reporting this.

commented

Fixed in 21.5.4 for neoforge and fabric