1 parent
0d2c21ada4
commit
b789953900
1 file changed
+5
-3
@@ -4,6 +4,8 @@ import carpet.CarpetSettings;
|
|||||||
import carpet.fakes.LevelInterface;
|
import carpet.fakes.LevelInterface;
|
||||||
import carpet.utils.SpawnReporter;
|
import carpet.utils.SpawnReporter;
|
||||||
import net.minecraft.world.entity.EntitySpawnReason;
|
import net.minecraft.world.entity.EntitySpawnReason;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -46,12 +48,12 @@ public class NaturalSpawnerMixin
|
|||||||
|
|
||||||
@Shadow @Final private static MobCategory[] SPAWNING_CATEGORIES;
|
@Shadow @Final private static MobCategory[] SPAWNING_CATEGORIES;
|
||||||
|
|
||||||
@Redirect(method = "isValidSpawnPostitionForType",
|
@WrapOperation(method = "isValidSpawnPostitionForType",
|
||||||
at = @At(
|
at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/server/level/ServerLevel;noCollision(Lnet/minecraft/world/phys/AABB;)Z"
|
target = "Lnet/minecraft/server/level/ServerLevel;noCollision(Lnet/minecraft/world/phys/AABB;)Z"
|
||||||
))
|
))
|
||||||
private static boolean doesNotCollide(ServerLevel world, AABB bb)
|
private static boolean doesNotCollide(ServerLevel world, AABB bb, Operation<Boolean> original)
|
||||||
{
|
{
|
||||||
//.doesNotCollide is VERY expensive. On the other side - most worlds are not made of trapdoors in
|
//.doesNotCollide is VERY expensive. On the other side - most worlds are not made of trapdoors in
|
||||||
// various configurations, but solid and 'passable' blocks, like air, water grass, etc.
|
// various configurations, but solid and 'passable' blocks, like air, water grass, etc.
|
||||||
@@ -59,7 +61,7 @@ public class NaturalSpawnerMixin
|
|||||||
// in case something more complex happens - we default to full block collision check
|
// in case something more complex happens - we default to full block collision check
|
||||||
if (!CarpetSettings.lagFreeSpawning)
|
if (!CarpetSettings.lagFreeSpawning)
|
||||||
{
|
{
|
||||||
return world.noCollision(bb);
|
return original.call(world, bb);
|
||||||
}
|
}
|
||||||
int minX = Mth.floor(bb.minX);
|
int minX = Mth.floor(bb.minX);
|
||||||
int minY = Mth.floor(bb.minY);
|
int minY = Mth.floor(bb.minY);
|
||||||
|
|||||||
Reference in new issue
Block a user