25w02a
This commit is contained in:
1 parent
d9c7334400
commit
b16eec89e7
34 files changed
+299
-347
No files matched your search
@@ -12,6 +12,8 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.random.Weighted;
|
||||
import net.minecraft.util.random.WeightedList;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntitySpawnReason;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
@@ -389,8 +391,8 @@ public class SpawnReporter
|
||||
}
|
||||
|
||||
// yeeted from NaturalSpawner - temporary access fix
|
||||
private static List<MobSpawnSettings.SpawnerData> getSpawnEntries(ServerLevel serverLevel, StructureManager structureManager, ChunkGenerator chunkGenerator, MobCategory mobCategory, BlockPos blockPos, @Nullable Holder<Biome> holder) {
|
||||
return NaturalSpawner.isInNetherFortressBounds(blockPos, serverLevel, mobCategory, structureManager) ? NetherFortressStructure.FORTRESS_ENEMIES.unwrap() : chunkGenerator.getMobsAt(holder != null ? holder : serverLevel.getBiome(blockPos), structureManager, mobCategory, blockPos).unwrap();
|
||||
private static WeightedList<MobSpawnSettings.SpawnerData> getSpawnEntries(ServerLevel serverLevel, StructureManager structureManager, ChunkGenerator chunkGenerator, MobCategory mobCategory, BlockPos blockPos, @Nullable Holder<Biome> holder) {
|
||||
return NaturalSpawner.isInNetherFortressBounds(blockPos, serverLevel, mobCategory, structureManager) ? NetherFortressStructure.FORTRESS_ENEMIES : chunkGenerator.getMobsAt(holder != null ? holder : serverLevel.getBiome(blockPos), structureManager, mobCategory, blockPos);
|
||||
}
|
||||
|
||||
public static List<Component> report(BlockPos pos, ServerLevel worldIn)
|
||||
@@ -407,21 +409,22 @@ public class SpawnReporter
|
||||
for (MobCategory category : cachedMobCategories())
|
||||
{
|
||||
String categoryCode = String.valueOf(category).substring(0, 3);
|
||||
List<MobSpawnSettings.SpawnerData> lst = getSpawnEntries(worldIn, worldIn.structureManager(), worldIn.getChunkSource().getGenerator(), category, pos, worldIn.getBiome(pos));
|
||||
WeightedList<MobSpawnSettings.SpawnerData> lst = getSpawnEntries(worldIn, worldIn.structureManager(), worldIn.getChunkSource().getGenerator(), category, pos, worldIn.getBiome(pos));
|
||||
if (lst != null && !lst.isEmpty())
|
||||
{
|
||||
for (MobSpawnSettings.SpawnerData spawnEntry : lst)
|
||||
for (Weighted<MobSpawnSettings.SpawnerData> wspawnEntry : lst.unwrap())
|
||||
{
|
||||
if (SpawnPlacements.getPlacementType(spawnEntry.type) == null)
|
||||
MobSpawnSettings.SpawnerData spawnEntry = wspawnEntry.value();
|
||||
if (SpawnPlacements.getPlacementType(spawnEntry.type()) == null)
|
||||
continue; // vanilla bug
|
||||
boolean canSpawn = SpawnPlacements.isSpawnPositionOk(spawnEntry.type, worldIn, pos);
|
||||
boolean canSpawn = SpawnPlacements.isSpawnPositionOk(spawnEntry.type(), worldIn, pos);
|
||||
int willSpawn = -1;
|
||||
boolean fits = false;
|
||||
|
||||
Mob mob;
|
||||
try
|
||||
{
|
||||
mob = (Mob) spawnEntry.type.create(worldIn, EntitySpawnReason.NATURAL);
|
||||
mob = (Mob) spawnEntry.type().create(worldIn, EntitySpawnReason.NATURAL);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -467,7 +470,7 @@ public class SpawnReporter
|
||||
|
||||
try
|
||||
{
|
||||
mob = (Mob) spawnEntry.type.create(worldIn, EntitySpawnReason.NATURAL);
|
||||
mob = (Mob) spawnEntry.type().create(worldIn, EntitySpawnReason.NATURAL);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -479,12 +482,12 @@ public class SpawnReporter
|
||||
|
||||
String mobTypeName = mob.getType().getDescription().getString();
|
||||
//String pack_size = Integer.toString(mob.getMaxSpawnClusterSize());//String.format("%d-%d", animal.minGroupCount, animal.maxGroupCount);
|
||||
int weight = spawnEntry.getWeight().asInt();
|
||||
int weight = wspawnEntry.weight();
|
||||
if (canSpawn)
|
||||
{
|
||||
String color = (fits && willSpawn > 0) ? "e" : "gi";
|
||||
rep.add(Messenger.c(
|
||||
String.format("%s %s: %s (%d:%d-%d/%d), can: ", color, categoryCode, mobTypeName, weight, spawnEntry.minCount, spawnEntry.maxCount, mob.getMaxSpawnClusterSize()),
|
||||
String.format("%s %s: %s (%d:%d-%d/%d), can: ", color, categoryCode, mobTypeName, weight, spawnEntry.minCount(), spawnEntry.maxCount(), mob.getMaxSpawnClusterSize()),
|
||||
"l YES",
|
||||
color + " , fit: ",
|
||||
(fits ? "l YES" : "r NO"),
|
||||
@@ -494,7 +497,7 @@ public class SpawnReporter
|
||||
}
|
||||
else
|
||||
{
|
||||
rep.add(Messenger.c(String.format("gi %s: %s (%d:%d-%d/%d), can: ", categoryCode, mobTypeName, weight, spawnEntry.minCount, spawnEntry.maxCount, mob.getMaxSpawnClusterSize()), "n NO"));
|
||||
rep.add(Messenger.c(String.format("gi %s: %s (%d:%d-%d/%d), can: ", categoryCode, mobTypeName, weight, spawnEntry.minCount(), spawnEntry.maxCount(), mob.getMaxSpawnClusterSize()), "n NO"));
|
||||
}
|
||||
killEntity(mob);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user