mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-14 19:56:19 +00:00
Fix various biome abstraction issues
This commit is contained in:
@@ -15,7 +15,6 @@ import java.util.Objects;
|
||||
|
||||
public class BiomeZone {
|
||||
private BiomeGrid[] grids;
|
||||
private final World w;
|
||||
private final FastNoise noise;
|
||||
private static final Map<World, BiomeZone> zones = new HashMap<>();
|
||||
@Nullable
|
||||
@@ -24,7 +23,6 @@ public class BiomeZone {
|
||||
private final ImageLoader.Channel channel;
|
||||
|
||||
private BiomeZone(World w) {
|
||||
this.w = w;
|
||||
this.noise = new FastNoise((int) w.getSeed()+2);
|
||||
this.noise.setNoiseType(FastNoise.NoiseType.SimplexFractal);
|
||||
this.noise.setFractalOctaves(4);
|
||||
@@ -57,4 +55,8 @@ public class BiomeZone {
|
||||
if(zones.containsKey(w)) return zones.get(w);
|
||||
else return new BiomeZone(w);
|
||||
}
|
||||
|
||||
public static void invalidate() {
|
||||
zones.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class TerraBiomeGrid extends BiomeGrid {
|
||||
private final World w;
|
||||
|
||||
public TerraBiomeGrid(World w) {
|
||||
super(w, 1f/256, 1f/512);
|
||||
super(w, WorldConfig.fromWorld(w).freq1, WorldConfig.fromWorld(w).freq2);
|
||||
this.w = w;
|
||||
grids.put(w, this);
|
||||
}
|
||||
@@ -37,6 +37,10 @@ public class TerraBiomeGrid extends BiomeGrid {
|
||||
return getBiome(l.getBlockX(), l.getBlockZ());
|
||||
}
|
||||
|
||||
public static void invalidate() {
|
||||
grids.clear();
|
||||
}
|
||||
|
||||
public UserDefinedGrid getGrid(int x, int z) {
|
||||
return (UserDefinedGrid) BiomeZone.fromWorld(w).getGrid(x, z);
|
||||
}
|
||||
|
||||
@@ -11,13 +11,14 @@ public class UserDefinedBiome implements Biome {
|
||||
private final UserDefinedGenerator gen;
|
||||
private final UserDefinedDecorator decorator;
|
||||
private final org.bukkit.block.Biome vanilla;
|
||||
private final String id;
|
||||
|
||||
|
||||
public UserDefinedBiome(org.bukkit.block.Biome vanilla, UserDefinedDecorator dec, UserDefinedGenerator gen) {
|
||||
|
||||
public UserDefinedBiome(org.bukkit.block.Biome vanilla, UserDefinedDecorator dec, UserDefinedGenerator gen, String id) {
|
||||
this.vanilla = vanilla;
|
||||
this.decorator = dec;
|
||||
this.gen = gen;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,4 +60,8 @@ public class UserDefinedBiome implements Biome {
|
||||
public Decorator getDecorator() {
|
||||
return decorator;
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,16 +14,6 @@ public class UserDefinedGrid extends BiomeGrid {
|
||||
private final boolean fromImage;
|
||||
private final ImageLoader.Channel channelX;
|
||||
private final ImageLoader.Channel channelZ;
|
||||
public UserDefinedGrid(World w, float freq1, float freq2, BiomeGridConfig config) {
|
||||
super(w, freq1, freq2, config.getBiomeGrid().length, config.getBiomeGrid()[0].length);
|
||||
super.setNormalType(NormalType.LOOKUP4096);
|
||||
super.setGrid(config.getBiomeGrid());
|
||||
WorldConfig c = WorldConfig.fromWorld(w);
|
||||
imageLoader = c.imageLoader;
|
||||
fromImage = c.fromImage;
|
||||
channelX = c.biomeXChannel;
|
||||
channelZ = c.biomeZChannel;
|
||||
}
|
||||
public UserDefinedGrid(World w, float freq1, float freq2, UserDefinedBiome[][] b) {
|
||||
super(w, freq1, freq2, b.length, b[0].length);
|
||||
super.setNormalType(NormalType.LOOKUP4096);
|
||||
|
||||
Reference in New Issue
Block a user