24w04a
This commit is contained in:
1 parent
ea3f51e6fb
commit
f316ffa3e2
4 files changed
+8
-22
No files matched your search
@@ -1,33 +1,21 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.entity.SpawnPlacementType;
|
||||
import net.minecraft.world.entity.SpawnPlacementTypes;
|
||||
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.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(SpawnPlacements.class)
|
||||
public class PiglinBrute_getPlacementTypeMixin {
|
||||
@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) {
|
||||
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 (NaturalSpawner.isSpawnPositionOk(spt, worldServer, pos, sle.type))
|
||||
if (SpawnPlacements.isSpawnPositionOk(sle.type, worldServer, pos))
|
||||
{
|
||||
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) &&
|
||||
|
||||
@@ -414,7 +414,7 @@ public class SpawnReporter
|
||||
{
|
||||
if (SpawnPlacements.getPlacementType(spawnEntry.type) == null)
|
||||
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;
|
||||
boolean fits = false;
|
||||
|
||||
@@ -444,7 +444,7 @@ public class SpawnReporter
|
||||
{
|
||||
if (
|
||||
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.canSpawn(worldIn) // entity collisions // mostly - except ocelots
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user