This commit is contained in:
gnembon committed 2024-01-24 23:52:01 +01:00
1 parent ea3f51e6fb
commit f316ffa3e2
4 files changed
+8 -22

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check https://fabricmc.net/develop/ # check https://fabricmc.net/develop/
minecraft_version=24w03a minecraft_version=24w04a
loader_version=0.15.6 loader_version=0.15.6
jsr305_version=3.0.2 jsr305_version=3.0.2
fabric_version=0.91.1+1.20.3 fabric_version=0.91.1+1.20.3
@@ -1,33 +1,21 @@
package carpet.mixins; package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.SpawnPlacementType;
import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.SpawnPlacementTypes;
import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.SpawnPlacements;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.monster.piglin.Piglin;
import net.minecraft.world.entity.monster.piglin.PiglinBrute;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.levelgen.Heightmap;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(SpawnPlacements.class) @Mixin(SpawnPlacements.class)
public class PiglinBrute_getPlacementTypeMixin { public class PiglinBrute_getPlacementTypeMixin {
@Inject(method = "getPlacementType", at = @At("HEAD"), cancellable = true) @Inject(method = "getPlacementType", at = @At("HEAD"), cancellable = true)
private static void getPlacementType(EntityType<?> entityType, CallbackInfoReturnable<SpawnPlacements.Type> cir) { private static void getPlacementType(final EntityType<?> entityType, final CallbackInfoReturnable<SpawnPlacementType> cir) {
if (CarpetSettings.piglinsSpawningInBastions && entityType == EntityType.PIGLIN_BRUTE) { if (CarpetSettings.piglinsSpawningInBastions && entityType == EntityType.PIGLIN_BRUTE) {
cir.setReturnValue(SpawnPlacements.Type.ON_GROUND); cir.setReturnValue(SpawnPlacementTypes.ON_GROUND);
} }
} }
} }
@@ -176,9 +176,7 @@ public class PerimeterDiagnostics
} }
} }
SpawnPlacements.Type spt = SpawnPlacements.getPlacementType(sle.type); if (SpawnPlacements.isSpawnPositionOk(sle.type, worldServer, pos))
if (NaturalSpawner.isSpawnPositionOk(spt, worldServer, pos, sle.type))
{ {
el.moveTo(pos.getX() + 0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F); el.moveTo(pos.getX() + 0.5F, pos.getY(), pos.getZ()+0.5F, 0.0F, 0.0F);
return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, MobSpawnType.NATURAL) && return el.checkSpawnObstruction(worldServer) && el.checkSpawnRules(worldServer, MobSpawnType.NATURAL) &&
@@ -414,7 +414,7 @@ public class SpawnReporter
{ {
if (SpawnPlacements.getPlacementType(spawnEntry.type) == null) if (SpawnPlacements.getPlacementType(spawnEntry.type) == null)
continue; // vanilla bug continue; // vanilla bug
boolean canSpawn = NaturalSpawner.isSpawnPositionOk(SpawnPlacements.getPlacementType(spawnEntry.type), worldIn, pos, spawnEntry.type); boolean canSpawn = SpawnPlacements.isSpawnPositionOk(spawnEntry.type, worldIn, pos);
int willSpawn = -1; int willSpawn = -1;
boolean fits = false; boolean fits = false;
@@ -444,7 +444,7 @@ public class SpawnReporter
{ {
if ( if (
SpawnPlacements.checkSpawnRules(etype,worldIn, MobSpawnType.NATURAL, pos, worldIn.random) && SpawnPlacements.checkSpawnRules(etype,worldIn, MobSpawnType.NATURAL, pos, worldIn.random) &&
NaturalSpawner.isSpawnPositionOk(SpawnPlacements.getPlacementType(etype), worldIn, pos, etype) && SpawnPlacements.isSpawnPositionOk(etype, worldIn, pos) &&
mob.checkSpawnRules(worldIn, MobSpawnType.NATURAL) mob.checkSpawnRules(worldIn, MobSpawnType.NATURAL)
// && mob.canSpawn(worldIn) // entity collisions // mostly - except ocelots // && mob.canSpawn(worldIn) // entity collisions // mostly - except ocelots
) )