mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 05:02:18 +00:00
Re-add missing default spawn lists in features (#8285)
Fixes #8265 Fixes #8301
This commit is contained in:
1 parent
0320c185b5
commit
7259887176
6 files changed
+67
-10
No files matched your search
@@ -35,6 +35,15 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -263,7 +_,7 @@
|
||||
}
|
||||
|
||||
private static WeightedRandomList<MobSpawnSettings.SpawnerData> 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;
|
||||
|
||||
+14
@@ -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<MobSpawnSettings.SpawnerData> 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();
|
||||
+ }
|
||||
}
|
||||
+6
-8
@@ -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<MobSpawnSettings.SpawnerData> 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<NoneFeatureConfiguration> p_197132_) {
|
||||
+ }
|
||||
}
|
||||
+14
@@ -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<MobSpawnSettings.SpawnerData> 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();
|
||||
+ }
|
||||
}
|
||||
+16
@@ -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<NoneFeatureConfiguration> 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<MobSpawnSettings.SpawnerData> 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();
|
||||
+ }
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user