Carpet

Carpet

2M Downloads

Mod incompatability [Harder Farther]

arazadaz opened this issue ยท 2 comments

commented

This is actually a mod I manage, so if you think something need's to be done on my end, just let me know. Anyways, this mod crashes with yours. It seems to conflict with my conditional mixin that prevents an entity from spawning if they don't meet the condition.

Here's the crash report: https://pastebin.com/8uT0JCeG

commented

I don't think Conditionality would work, but regardless, I overhauled the relevant section of my code and it is now compatible.

commented

I think it's because both mods are redirecting the same method in SpawnHelper, spawnEntityAndPassengers (mojmap: NaturalSpawner.addFreshEntityWithPassengers), and two redirects for the same can't exist at the same time.

So for them to be compatible one would need to be changed, or maybe one of Mixin Extra's alternative redirector (WrapWithCondition) could make it work, but gnembon doesn't want Carpet to use libraries too much if possible I think.

Here's the mixin in Carpet:

@Redirect(method = "spawnCategoryForPosition(Lnet/minecraft/world/entity/MobCategory;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkAccess;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/NaturalSpawner$SpawnPredicate;Lnet/minecraft/world/level/NaturalSpawner$AfterSpawnCallback;)V", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/level/ServerLevel;addFreshEntityWithPassengers(Lnet/minecraft/world/entity/Entity;)V"
))
private static void spawnEntity(ServerLevel world, Entity entity_1,
MobCategory group, ServerLevel world2, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate checker, NaturalSpawner.AfterSpawnCallback runner)
{
if (CarpetSettings.lagFreeSpawning)
// we used the mob - next time we will create a new one when needed
((LevelInterface) world).getPrecookedMobs().remove(entity_1.getType());
if (SpawnReporter.track_spawns > 0L && SpawnReporter.local_spawns != null)
{
SpawnReporter.registerSpawn(
//world.method_27983(), // getDimensionType //dimension.getType(), // getDimensionType
(Mob) entity_1,
group, //entity_1.getType().getSpawnGroup(),
entity_1.blockPosition());
}
if (!SpawnReporter.mock_spawns)
world.addFreshEntityWithPassengers(entity_1);
//world.spawnEntity(entity_1);
}

I personally don't know much about this part of the code, so I wouldn't know how to adapt it, or even if it would be possible to from Carpet. This code seems to be managing our /spawn reporting and mocking, and something for the lagFreeSpawning rule.