This commit is contained in:
gnembon committed 2021-09-24 09:29:13 -03:00
1 parent 7b9e5e6feb
commit e849cdf6c1
11 files changed
+182 -91

No files matched your search

@@ -1,6 +1,7 @@
package carpet.mixins;
import carpet.CarpetSettings;
import carpet.helpers.CustomSpawnLists;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.collection.Pool;
import net.minecraft.util.math.BlockPos;
@@ -11,7 +12,11 @@ import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.FlatChunkGenerator;
import net.minecraft.world.gen.chunk.StructuresConfig;
import net.minecraft.world.gen.feature.NetherFortressFeature;
import net.minecraft.world.gen.feature.OceanMonumentFeature;
import net.minecraft.world.gen.feature.PillagerOutpostFeature;
import net.minecraft.world.gen.feature.StructureFeature;
import net.minecraft.world.gen.feature.SwampHutFeature;
import org.spongepowered.asm.mixin.Mixin;
import java.util.List;
@@ -28,55 +33,61 @@ public abstract class FlatChunkGeneratorMixin extends ChunkGenerator
@Override
public Pool<SpawnSettings.SpawnEntry> getEntitySpawnList(Biome biome, StructureAccessor accessor, SpawnGroup group, BlockPos pos)
{
if (CarpetSettings.flatWorldStructureSpawning)
{
if (accessor.getStructureAt(pos, true, StructureFeature.SWAMP_HUT).hasChildren())
{ //swamp hut
if (group == SpawnGroup.MONSTER)
{
return StructureFeature.SWAMP_HUT.getMonsterSpawns();
}
if (!CarpetSettings.flatWorldStructureSpawning) return super.getEntitySpawnList(biome, accessor, group, pos);
if (group == SpawnGroup.CREATURE)
{
return StructureFeature.SWAMP_HUT.getCreatureSpawns();
}
// vanila noise one
if (accessor.getStructureAt(pos, true, StructureFeature.SWAMP_HUT).hasChildren()) {
if (group == SpawnGroup.MONSTER) {
return SwampHutFeature.MONSTER_SPAWNS;
}
if (group == SpawnGroup.MONSTER)
if (group == SpawnGroup.CREATURE) {
return SwampHutFeature.CREATURE_SPAWNS;
}
}
if (group == SpawnGroup.MONSTER) {
if (accessor.getStructureAt(pos, false, StructureFeature.PILLAGER_OUTPOST).hasChildren()) {
return PillagerOutpostFeature.MONSTER_SPAWNS;
}
if (accessor.getStructureAt(pos, false, StructureFeature.MONUMENT).hasChildren()) {
return OceanMonumentFeature.MONSTER_SPAWNS;
}
if (accessor.getStructureAt(pos, true, StructureFeature.FORTRESS).hasChildren()) {
return NetherFortressFeature.MONSTER_SPAWNS;
}
}
// carpet spawns
if (group == SpawnGroup.MONSTER)
{
if (CarpetSettings.huskSpawningInTemples)
{
if (accessor.getStructureAt(pos, false, StructureFeature.PILLAGER_OUTPOST).hasChildren())
if (accessor.getStructureAt(pos, true, StructureFeature.DESERT_PYRAMID).hasChildren())
{
return StructureFeature.PILLAGER_OUTPOST.getMonsterSpawns();
return CustomSpawnLists.PYRAMID_SPAWNS;
}
if (CarpetSettings.huskSpawningInTemples)
}
if (CarpetSettings.shulkerSpawningInEndCities)
{
if (accessor.getStructureAt(pos, true, StructureFeature.END_CITY).hasChildren())
{
if (accessor.getStructureAt(pos, true, StructureFeature.DESERT_PYRAMID).hasChildren())
{
return StructureFeature.DESERT_PYRAMID.getMonsterSpawns();
}
return CustomSpawnLists.SHULKER_SPAWNS;
}
if (accessor.getStructureAt(pos, false, StructureFeature.MONUMENT).hasChildren())
}
if (CarpetSettings.piglinsSpawningInBastions)
{
if (accessor.getStructureAt(pos, true, StructureFeature.BASTION_REMNANT).hasChildren())
{
return StructureFeature.MONUMENT.getMonsterSpawns();
}
if (accessor.getStructureAt(pos, true, StructureFeature.FORTRESS).hasChildren())
{
return StructureFeature.FORTRESS.getMonsterSpawns();
}
if (CarpetSettings.shulkerSpawningInEndCities)
{
if (accessor.getStructureAt(pos, true, StructureFeature.END_CITY).hasChildren())
{
return StructureFeature.END_CITY.getMonsterSpawns();
}
return CustomSpawnLists.BASTION_SPAWNS;
}
}
}
return super.getEntitySpawnList(biome, accessor, group, pos);
return (group == SpawnGroup.UNDERGROUND_WATER_CREATURE || group == SpawnGroup.AXOLOTLS) && accessor.getStructureAt(pos, false, StructureFeature.MONUMENT).hasChildren() ? SpawnSettings.EMPTY_ENTRY_POOL : super.getEntitySpawnList(biome, accessor, group, pos);
}
}