ForgePatch/patches/minecraft/net/minecraft/world/biome/Biome.java.patch

71 lines
3.2 KiB
Diff

--- a/net/minecraft/world/biome/Biome.java
+++ b/net/minecraft/world/biome/Biome.java
@@ -144,7 +144,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public abstract class Biome {
+public abstract class Biome extends net.minecraftforge.registries.ForgeRegistryEntry<Biome> {
public static final Logger field_150586_aC = LogManager.getLogger();
public static final WorldCarver<ProbabilityConfig> field_201907_b = new CaveWorldCarver();
public static final WorldCarver<ProbabilityConfig> field_201908_c = new NetherCaveWorldCarver();
@@ -233,7 +233,7 @@
public static final ObjectIntIdentityMap<Biome> field_185373_j = new ObjectIntIdentityMap<Biome>();
protected static final NoiseGeneratorPerlin field_150605_ac = new NoiseGeneratorPerlin(new Random(1234L), 1);
public static final NoiseGeneratorPerlin field_180281_af = new NoiseGeneratorPerlin(new Random(2345L), 1);
- public static final RegistryNamespaced<ResourceLocation, Biome> field_185377_q = new RegistryNamespaced<ResourceLocation, Biome>();
+ public static final RegistryNamespaced<ResourceLocation, Biome> field_185377_q = net.minecraftforge.registries.GameData.getWrapper(Biome.class);
@Nullable
protected String field_205405_aL;
protected final float field_76748_D;
@@ -299,7 +299,6 @@
for(EnumCreatureType enumcreaturetype : EnumCreatureType.values()) {
this.field_201880_ax.put(enumcreaturetype, Lists.<Biome.SpawnListEntry>newArrayList());
}
-
} else {
throw new IllegalStateException("You are missing parameters to build a proper biome for " + this.getClass().getSimpleName() + "\n" + p_i48975_1_);
}
@@ -332,11 +331,11 @@
}
public void func_201866_a(EnumCreatureType p_201866_1_, Biome.SpawnListEntry p_201866_2_) {
- (this.field_201880_ax.get(p_201866_1_)).add(p_201866_2_);
+ (this.field_201880_ax.computeIfAbsent(p_201866_1_, k -> Lists.newArrayList())).add(p_201866_2_);
}
public List<Biome.SpawnListEntry> func_76747_a(EnumCreatureType p_76747_1_) {
- return this.field_201880_ax.get(p_76747_1_);
+ return this.field_201880_ax.computeIfAbsent(p_76747_1_, k -> Lists.newArrayList());
}
public Biome.RainType func_201851_b() {
@@ -393,7 +392,7 @@
} else {
if (p_201850_2_.func_177956_o() >= 0 && p_201850_2_.func_177956_o() < 256 && p_201850_1_.func_175642_b(EnumLightType.BLOCK, p_201850_2_) < 10) {
IBlockState iblockstate = p_201850_1_.func_180495_p(p_201850_2_);
- if (iblockstate.func_196958_f() && Blocks.field_150433_aE.func_176223_P().func_196955_c(p_201850_1_, p_201850_2_)) {
+ if (iblockstate.isAir(p_201850_1_, p_201850_2_) && Blocks.field_150433_aE.func_176223_P().func_196955_c(p_201850_1_, p_201850_2_)) {
return true;
}
}
@@ -752,6 +751,18 @@
}
}
+ public static class FlowerEntry extends WeightedRandom.Item {
+ private final IBlockState state;
+ public FlowerEntry(IBlockState state, int weight) {
+ super(weight);
+ this.state = state;
+ }
+
+ public IBlockState getState() {
+ return state;
+ }
+ }
+
public static enum TempCategory {
OCEAN,
COLD,