diff --git a/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch b/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch index ef6ca29e27..aeb450cb6b 100644 --- a/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch +++ b/patches/minecraft/net/minecraft/world/level/NaturalSpawner.java.patch @@ -35,6 +35,15 @@ return; } +@@ -263,7 +_,7 @@ + } + + private static WeightedRandomList m_151591_(ServerLevel p_151592_, StructureFeatureManager p_151593_, ChunkGenerator p_151594_, MobCategory p_151595_, BlockPos p_151596_, @Nullable Biome p_151597_) { +- return m_186529_(p_151596_, p_151592_, p_151595_, p_151593_) ? NetherFortressFeature.f_66381_ : p_151594_.m_142184_(p_151597_ != null ? p_151597_ : p_151592_.m_46857_(p_151596_), p_151593_, p_151595_, p_151596_); ++ return m_186529_(p_151596_, p_151592_, p_151595_, p_151593_) ? StructureFeature.f_67025_.getSpawnList(MobCategory.MONSTER) : p_151594_.m_142184_(p_151597_ != null ? p_151597_ : p_151592_.m_46857_(p_151596_), p_151593_, p_151595_, p_151596_); + } + + public static boolean m_186529_(BlockPos p_186530_, ServerLevel p_186531_, MobCategory p_186532_, StructureFeatureManager p_186533_) { @@ -297,6 +_,13 @@ if (p_47052_ == SpawnPlacements.Type.NO_RESTRICTIONS) { return true; diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java.patch new file mode 100644 index 0000000000..40f64830e1 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java ++++ b/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java +@@ -42,4 +_,11 @@ + + p_197129_.m_192792_(p_197130_.f_192708_(), 48, 70); + } ++ ++ @Override ++ public List getDefaultSpawnList(net.minecraft.world.entity.MobCategory category) { ++ if (category == net.minecraft.world.entity.MobCategory.MONSTER) ++ return f_66381_.m_146338_(); ++ return java.util.Collections.emptyList(); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java.patch index 5aa405a10c..a64b7798c2 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java.patch @@ -1,16 +1,14 @@ --- a/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java +++ b/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java -@@ -28,8 +_,11 @@ - super(p_66472_, PieceGeneratorSupplier.m_197349_(OceanMonumentFeature::m_197131_, OceanMonumentFeature::m_191045_)); +@@ -74,4 +_,11 @@ + return structurepiecesbuilder.m_192780_(); + } } - -- protected boolean m_5910_() { -- return false; ++ + @Override + public java.util.List getDefaultSpawnList(net.minecraft.world.entity.MobCategory category) { + if (category == net.minecraft.world.entity.MobCategory.MONSTER) + return f_66469_.m_146338_(); + return java.util.Collections.emptyList(); - } - - private static boolean m_197131_(PieceGeneratorSupplier.Context p_197132_) { ++ } + } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java.patch new file mode 100644 index 0000000000..571148aa0e --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java.patch @@ -0,0 +1,14 @@ +--- a/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java ++++ b/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java +@@ -52,4 +_,11 @@ + return false; + } + } ++ ++ @Override ++ public java.util.List getDefaultSpawnList(net.minecraft.world.entity.MobCategory category) { ++ if (category == net.minecraft.world.entity.MobCategory.MONSTER) ++ return f_66559_.m_146338_(); ++ return java.util.Collections.emptyList(); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java.patch new file mode 100644 index 0000000000..e19a9daa09 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java ++++ b/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java +@@ -22,4 +_,13 @@ + private static void m_197181_(StructurePiecesBuilder p_197182_, PieceGenerator.Context p_197183_) { + p_197182_.m_142679_(new SwamplandHutPiece(p_197183_.f_192708_(), p_197183_.f_192705_().m_45604_(), p_197183_.f_192705_().m_45605_())); + } ++ ++ @Override ++ public java.util.List getDefaultSpawnList(net.minecraft.world.entity.MobCategory category) { ++ if (category == net.minecraft.world.entity.MobCategory.MONSTER) ++ return f_67169_.m_146338_(); ++ else if (category == net.minecraft.world.entity.MobCategory.CREATURE) ++ return f_67170_.m_146338_(); ++ return java.util.Collections.emptyList(); ++ } + } diff --git a/src/main/java/net/minecraftforge/common/world/StructureSpawnManager.java b/src/main/java/net/minecraftforge/common/world/StructureSpawnManager.java index ecf61869f8..401f301306 100644 --- a/src/main/java/net/minecraftforge/common/world/StructureSpawnManager.java +++ b/src/main/java/net/minecraftforge/common/world/StructureSpawnManager.java @@ -98,8 +98,14 @@ public class StructureSpawnManager StructureFeature structure = entry.getKey(); StructureSpawnInfo spawnInfo = entry.getValue(); //Note: We check if the structure has spawns for a type first before looking at the world as it should be a cheaper check - if (spawnInfo.spawns.containsKey(classification) && structureManager.getStructureAt(pos, structure).isValid()) - return spawnInfo.spawns.get(classification); + if (spawnInfo.spawns.containsKey(classification)) + { + boolean valid = spawnInfo.insideOnly + ? structureManager.getStructureWithPieceAt(pos, structure).isValid() + : structureManager.getStructureAt(pos, structure).isValid(); + if (valid) + return spawnInfo.spawns.get(classification); + } } return null; }