mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 03:25:18 +00:00
Fix misaligned patch causing monsters to not spawn in nether fortresses correctly.
This commit is contained in:
1 parent
aa97ddad8b
commit
559b801cc4
9 files changed
+65
-25
No files matched your search
@@ -69,7 +69,7 @@
|
||||
entity.m_7678_(d0, (double)blockpos.m_123342_(), d1, p_151620_.nextFloat() * 360.0F, 0.0F);
|
||||
if (entity instanceof Mob) {
|
||||
Mob mob = (Mob)entity;
|
||||
+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mob, p_151617_, d0, blockpos.m_123342_(), d1, null, MobSpawnType.CHUNK_GENERATION) == -1) continue;
|
||||
+ if (net.minecraftforge.common.ForgeHooks.canEntitySpawn(mob, p_151617_, d0, blockpos.m_123342_(), d1, null, MobSpawnType.CHUNK_GENERATION) == -1) continue;
|
||||
if (mob.m_5545_(p_151617_, MobSpawnType.CHUNK_GENERATION) && mob.m_6914_(p_151617_)) {
|
||||
spawngroupdata = mob.m_6518_(p_151617_, p_151617_.m_6436_(mob.m_142538_()), MobSpawnType.CHUNK_GENERATION, spawngroupdata, (CompoundTag)null);
|
||||
p_151617_.m_47205_(mob);
|
||||
+5
-3
@@ -1,14 +1,16 @@
|
||||
--- a/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/NetherFortressFeature.java
|
||||
@@ -33,8 +_,9 @@
|
||||
@@ -33,8 +_,11 @@
|
||||
return NetherFortressFeature.NetherBridgeStart::new;
|
||||
}
|
||||
|
||||
- public WeightedRandomList<MobSpawnSettings.SpawnerData> m_142494_() {
|
||||
- return f_66381_;
|
||||
+ @Override
|
||||
+ public List<MobSpawnSettings.SpawnerData> getDefaultSpawnList() {
|
||||
+ return f_66381_.m_146338_();
|
||||
+ 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();
|
||||
}
|
||||
|
||||
public static class NetherBridgeStart extends StructureStart<NoneFeatureConfiguration> {
|
||||
+5
-3
@@ -1,14 +1,16 @@
|
||||
--- a/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/OceanMonumentFeature.java
|
||||
@@ -55,8 +_,9 @@
|
||||
@@ -55,8 +_,11 @@
|
||||
return OceanMonumentFeature.OceanMonumentStart::new;
|
||||
}
|
||||
|
||||
- public WeightedRandomList<MobSpawnSettings.SpawnerData> m_142494_() {
|
||||
- return f_66469_;
|
||||
+ @Override
|
||||
+ public java.util.List<MobSpawnSettings.SpawnerData> getDefaultSpawnList() {
|
||||
+ return f_66469_.m_146338_();
|
||||
+ 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();
|
||||
}
|
||||
|
||||
public static class OceanMonumentStart extends StructureStart<NoneFeatureConfiguration> {
|
||||
+5
-3
@@ -1,14 +1,16 @@
|
||||
--- a/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/PillagerOutpostFeature.java
|
||||
@@ -20,8 +_,9 @@
|
||||
@@ -20,8 +_,11 @@
|
||||
super(p_66562_, 0, true, true);
|
||||
}
|
||||
|
||||
- public WeightedRandomList<MobSpawnSettings.SpawnerData> m_142494_() {
|
||||
- return f_66559_;
|
||||
+ @Override
|
||||
+ public java.util.List<MobSpawnSettings.SpawnerData> getDefaultSpawnList() {
|
||||
+ return f_66559_.m_146338_();
|
||||
+ 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();
|
||||
}
|
||||
|
||||
protected boolean m_142290_(ChunkGenerator p_160197_, BiomeSource p_160198_, long p_160199_, WorldgenRandom p_160200_, ChunkPos p_160201_, Biome p_160202_, ChunkPos p_160203_, JigsawConfiguration p_160204_, LevelHeightAccessor p_160205_) {
|
||||
+8
-3
@@ -9,17 +9,22 @@
|
||||
public static final BiMap<String, StructureFeature<?>> f_67012_ = HashBiMap.create();
|
||||
private static final Map<StructureFeature<?>, GenerationStep.Decoration> f_67032_ = Maps.newHashMap();
|
||||
private static final Logger f_67033_ = LogManager.getLogger();
|
||||
@@ -254,11 +_,16 @@
|
||||
@@ -250,15 +_,20 @@
|
||||
}
|
||||
|
||||
public WeightedRandomList<MobSpawnSettings.SpawnerData> m_142498_() {
|
||||
public WeightedRandomList<MobSpawnSettings.SpawnerData> m_142494_() {
|
||||
- return MobSpawnSettings.f_151796_;
|
||||
+ return getSpawnList(net.minecraft.world.entity.MobCategory.MONSTER);
|
||||
}
|
||||
|
||||
public WeightedRandomList<MobSpawnSettings.SpawnerData> m_160477_() {
|
||||
public WeightedRandomList<MobSpawnSettings.SpawnerData> m_142498_() {
|
||||
- return MobSpawnSettings.f_151796_;
|
||||
+ return getSpawnList(net.minecraft.world.entity.MobCategory.CREATURE);
|
||||
}
|
||||
|
||||
public WeightedRandomList<MobSpawnSettings.SpawnerData> m_160477_() {
|
||||
- return MobSpawnSettings.f_151796_;
|
||||
+ return getSpawnList(net.minecraft.world.entity.MobCategory.UNDERGROUND_WATER_CREATURE);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
||||
+9
-8
@@ -1,21 +1,22 @@
|
||||
--- a/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/SwamplandHutFeature.java
|
||||
@@ -26,12 +_,14 @@
|
||||
@@ -26,12 +_,13 @@
|
||||
return SwamplandHutFeature.FeatureStart::new;
|
||||
}
|
||||
|
||||
- public WeightedRandomList<MobSpawnSettings.SpawnerData> m_142494_() {
|
||||
- return f_67169_;
|
||||
+ @Override
|
||||
+ public java.util.List<MobSpawnSettings.SpawnerData> getDefaultSpawnList() {
|
||||
+ return f_67169_.m_146338_();
|
||||
}
|
||||
|
||||
- }
|
||||
-
|
||||
- public WeightedRandomList<MobSpawnSettings.SpawnerData> m_142498_() {
|
||||
- return f_67170_;
|
||||
+ @Override
|
||||
+ public java.util.List<MobSpawnSettings.SpawnerData> getDefaultCreatureSpawnList() {
|
||||
+ return f_67170_.m_146338_();
|
||||
+ 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();
|
||||
}
|
||||
|
||||
public static class FeatureStart extends StructureStart<NoneFeatureConfiguration> {
|
||||
@@ -33,10 +33,28 @@ public interface IForgeStructureFeature
|
||||
return (StructureFeature<?>) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default list of spawns for this structure, of the specified category.
|
||||
*
|
||||
* @apiNote Implement this over any of the type specific getSpecial functions in StructureFeature.
|
||||
*/
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
default List<MobSpawnSettings.SpawnerData> getDefaultSpawnList(MobCategory category)
|
||||
{
|
||||
if (category == MobCategory.MONSTER)
|
||||
return getDefaultSpawnList();
|
||||
else if (category == MobCategory.CREATURE)
|
||||
return getDefaultCreatureSpawnList();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default list of {@link EntityClassification#MONSTER} spawns for this structure.
|
||||
*
|
||||
* @apiNote Implement this over {@link Structure#getSpawnList()}
|
||||
*
|
||||
* @Deprecated Use {@link IForgeStructureFeature#getDefaultSpawnList(MobCategory)}
|
||||
* TODO: Remove in 1.18
|
||||
*/
|
||||
default List<MobSpawnSettings.SpawnerData> getDefaultSpawnList()
|
||||
{
|
||||
@@ -47,6 +65,9 @@ public interface IForgeStructureFeature
|
||||
* Gets the default list of {@link EntityClassification#CREATURE} spawns for this structure.
|
||||
*
|
||||
* @apiNote Implement this over {@link Structure#getCreatureSpawnList()}
|
||||
*
|
||||
* @Deprecated Use {@link IForgeStructureFeature#getDefaultSpawnList(MobCategory)}
|
||||
* TODO: Remove in 1.18
|
||||
*/
|
||||
default List<MobSpawnSettings.SpawnerData> getDefaultCreatureSpawnList()
|
||||
{
|
||||
|
||||
@@ -111,8 +111,9 @@ public class StructureSpawnManager
|
||||
*/
|
||||
public static WeightedRandomList<MobSpawnSettings.SpawnerData> getSpawnList(StructureFeature<?> structure, MobCategory classification)
|
||||
{
|
||||
if (structuresWithSpawns.containsKey(structure))
|
||||
return structuresWithSpawns.get(structure).spawns.getOrDefault(classification, WeightedRandomList.create());
|
||||
StructureSpawnInfo info = structuresWithSpawns.get(structure);
|
||||
if (info != null)
|
||||
return info.spawns.getOrDefault(classification, WeightedRandomList.create());
|
||||
return WeightedRandomList.create();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,9 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.level.SpawnData;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
@@ -55,8 +57,12 @@ public class StructureSpawnListGatherEvent extends Event
|
||||
{
|
||||
this.structure = structure;
|
||||
this.insideOnly = this.structure.getDefaultRestrictsSpawnsToInside();
|
||||
addEntitySpawns(MobCategory.MONSTER, this.structure.getDefaultSpawnList());
|
||||
addEntitySpawns(MobCategory.CREATURE, this.structure.getDefaultCreatureSpawnList());
|
||||
|
||||
for (MobCategory cat : MobCategory.values()) {
|
||||
List<SpawnerData> lst = this.structure.getDefaultSpawnList(cat);
|
||||
if (!lst.isEmpty())
|
||||
addEntitySpawns(cat, lst);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user