Skip to content

Commit

Permalink
added 7.2 world features
Browse files Browse the repository at this point in the history
  • Loading branch information
UselessBullets committed May 9, 2024
1 parent ea9a034 commit b07c303
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ public class OverworldConfig extends OreConfig {
@Expose @SerializedName(value = "Grass Density")
public HashMap<String, Integer> grassDensityMap = new HashMap<>();
@Expose @SerializedName(value = "Flower Density")
@Deprecated
public HashMap<String, Integer> flowerDensityMap = new HashMap<>();
@Expose @SerializedName(value = "Yellow Flower Density")
@Deprecated
public HashMap<String, Integer> yellowFlowerDensityMap = new HashMap<>();
@Expose @SerializedName(value = "Tree Density")
public HashMap<String, Integer> treeDensityMap = new HashMap<>();
Expand Down Expand Up @@ -105,8 +107,10 @@ public Integer getGrassDensity(Biome biome, int defaultValue){
return grassDensityMap.getOrDefault(Registries.BIOMES.getKey(biome), defaultValue);
}

/**Specifies the number of chances for red/yellow flowers patches to spawn for the specified biome
/**
* @deprecated As of BTA 7.2 flower generation has changed in such a way where using maps for each flower density is impractical
*/
@Deprecated
public void addFlowerDensity(Biome biome, int density){
if (getConfigOverride() && getFlowerDensity(biome) != null){
return;
Expand All @@ -115,23 +119,27 @@ public void addFlowerDensity(Biome biome, int density){
}

/**
* @return Biome's red/yellow density, returns null if there is no entry for the biome
* @deprecated As of BTA 7.2 flower generation has changed in such a way where using maps for each flower density is impractical
*/
@Deprecated
@Nullable
public Integer getFlowerDensity(Biome biome){
return flowerDensityMap.get(Registries.BIOMES.getKey(biome));
}

/**
* @return Biome's red/yellow density, returns defaultValue if there is no entry for the biome
* @deprecated As of BTA 7.2 flower generation has changed in such a way where using maps for each flower density is impractical
*/
@Deprecated
@NotNull
public Integer getFlowerDensity(Biome biome, int defaultValue){
return flowerDensityMap.getOrDefault(Registries.BIOMES.getKey(biome), defaultValue);
}

/**Specifies the number of chances for yellow flowers to spawn for the specified biome
/**
* @deprecated As of BTA 7.2 flower generation has changed in such a way where using maps for each flower density is impractical
*/
@Deprecated
public void addYellowFlowerDensity(Biome biome, int density){
if (getConfigOverride() && getYellowFlowerDensity(biome) != null){
return;
Expand All @@ -140,16 +148,19 @@ public void addYellowFlowerDensity(Biome biome, int density){
}

/**
* @return Biome's yellow flower density, returns null if there is no entry for the biome
* @deprecated As of BTA 7.2 flower generation has changed in such a way where using maps for each flower density is impractical
*/
@Deprecated

@Nullable
public Integer getYellowFlowerDensity(Biome biome){
return yellowFlowerDensityMap.get(Registries.BIOMES.getKey(biome));
}

/**
* @return Biome's yellow flower density, returns defaultValue if there is no entry for the biome
* @deprecated As of BTA 7.2 flower generation has changed in such a way where using maps for each flower density is impractical
*/
@Deprecated
@NotNull
public Integer getYellowFlowerDensity(Biome biome, int defaultValue){
return yellowFlowerDensityMap.getOrDefault(Registries.BIOMES.getKey(biome), defaultValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,16 @@ protected void initValues() {
overworldConfig.addGrassDensity(Biomes.OVERWORLD_FOREST, 2);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_MEADOW, 2);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_RAINFOREST, 10);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_DESERT, 5);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_SEASONAL_FOREST, 2);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_TAIGA, 1);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_BOREAL_FOREST, 5);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_PLAINS, 10);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_GRASSLANDS, 8);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_CAATINGA, 2);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_SWAMPLAND, 4);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_SHRUBLAND, 2);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_OUTBACK_GRASSY, 25);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_BIRCH_FOREST, 10);

overworldConfig.addFlowerDensity(Biomes.OVERWORLD_SEASONAL_FOREST, 1);
overworldConfig.addFlowerDensity(Biomes.OVERWORLD_MEADOW, 2);
overworldConfig.addFlowerDensity(Biomes.OVERWORLD_BOREAL_FOREST, 2);
overworldConfig.addFlowerDensity(Biomes.OVERWORLD_SHRUBLAND, 1);

overworldConfig.addYellowFlowerDensity(Biomes.OVERWORLD_FOREST, 2);
overworldConfig.addYellowFlowerDensity(Biomes.OVERWORLD_SWAMPLAND, 2);
overworldConfig.addYellowFlowerDensity(Biomes.OVERWORLD_TAIGA, 2);
overworldConfig.addYellowFlowerDensity(Biomes.OVERWORLD_PLAINS, 3);
overworldConfig.addYellowFlowerDensity(Biomes.OVERWORLD_OUTBACK_GRASSY, 2);
overworldConfig.addYellowFlowerDensity(Biomes.OVERWORLD_OUTBACK, 2);
overworldConfig.addGrassDensity(Biomes.OVERWORLD_BIRCH_FOREST, 2);

overworldConfig.addTreeDensity(Biomes.OVERWORLD_FOREST, 5);
overworldConfig.addTreeDensity(Biomes.OVERWORLD_SHRUBLAND, -2);
overworldConfig.addTreeDensity(Biomes.OVERWORLD_BIRCH_FOREST, 4);
overworldConfig.addTreeDensity(Biomes.OVERWORLD_RAINFOREST, 10);
overworldConfig.addTreeDensity(Biomes.OVERWORLD_SEASONAL_FOREST, 2);
Expand All @@ -56,6 +43,7 @@ protected void initValues() {
overworldConfig.addTreeDensity(Biomes.OVERWORLD_DESERT, -1000);
overworldConfig.addTreeDensity(Biomes.OVERWORLD_TUNDRA, -1000);
overworldConfig.addTreeDensity(Biomes.OVERWORLD_PLAINS, -1000);
overworldConfig.addTreeDensity(Biomes.OVERWORLD_CAATINGA, 4);
overworldConfig.addTreeDensity(Biomes.OVERWORLD_SWAMPLAND, 4);
overworldConfig.addTreeDensity(Biomes.OVERWORLD_OUTBACK_GRASSY, 0);

Expand Down Expand Up @@ -114,11 +102,108 @@ protected void initBiome() {
biomeFeatures.addFeatureSurface(new WorldFeatureRichScorchedDirt(10), 1, new Biome[]{Biomes.OVERWORLD_OUTBACK, Biomes.OVERWORLD_OUTBACK_GRASSY});
biomeFeatures.addFeature(OverworldFunctions::getTreeFeature, null, OverworldFunctions::getTreeDensity, null, -1f);
biomeFeatures.addFeatureSurface(new WorldFeatureSugarCaneTall(), 1, new Biome[]{Biomes.OVERWORLD_RAINFOREST});
biomeFeatures.addFeature(OverworldFunctions::flowerTypeCondition, null, (Parameters x) -> overworldConfig.getFlowerDensity(x.biome, 0), null, 1f);
biomeFeatures.addFeature((Parameters x) -> new WorldFeatureFlowers(Block.flowerYellow.id), null, (Parameters x) -> overworldConfig.getYellowFlowerDensity(x.biome, 0), null, 1);

biomeFeatures.addFeature(
parameters -> {
int blockId = Block.flowerPurple.id;
if (parameters.random.nextInt(12) == 0) {
blockId = Block.flowerRed.id;
}

if (parameters.random.nextInt(6) == 0) {
blockId = Block.flowerYellow.id;
}
return new WorldFeatureTallGrass(blockId);
}, null,
parameters -> {
if (parameters.biome == Biomes.OVERWORLD_MEADOW){
return 3;
}
if (parameters.biome == Biomes.OVERWORLD_BOREAL_FOREST){
return 2;
}
if (parameters.biome == Biomes.OVERWORLD_SHRUBLAND){
return 1;
}
if (parameters.biome == Biomes.OVERWORLD_TAIGA){
return 1;
}
return 0;
}, null, 1f);

biomeFeatures.addFeature(
parameters -> new WorldFeatureFlowers(Block.flowerLightBlue.id), null,
parameters -> {
if (parameters.biome == Biomes.OVERWORLD_FOREST){
return 2;
}
if (parameters.biome == Biomes.OVERWORLD_SWAMPLAND){
return 3;
}
if (parameters.biome == Biomes.OVERWORLD_RAINFOREST){
return 4;
}
if (parameters.biome == Biomes.OVERWORLD_CAATINGA || parameters.biome == Biomes.OVERWORLD_CAATINGA_PLAINS){
return 3;
}
return 0;
}, null, 1f);

biomeFeatures.addFeature(
parameters -> new WorldFeatureFlowers(Block.flowerOrange.id), null,
parameters -> {
if (parameters.biome == Biomes.OVERWORLD_GRASSLANDS){
return 1;
}
if (parameters.biome == Biomes.OVERWORLD_PLAINS){
return 5;
}
if (parameters.biome == Biomes.OVERWORLD_CAATINGA || parameters.biome == Biomes.OVERWORLD_CAATINGA_PLAINS){
return 5;
}
if (parameters.biome == Biomes.OVERWORLD_OUTBACK_GRASSY || parameters.biome == Biomes.OVERWORLD_OUTBACK){
return 3;
}
return 0;
}, null, 1f);

biomeFeatures.addFeature(
parameters -> new WorldFeatureFlowers(Block.flowerYellow.id), null,
parameters -> {
if (parameters.biome == Biomes.OVERWORLD_FOREST){
return 2;
}
if (parameters.biome == Biomes.OVERWORLD_SWAMPLAND){
return 2;
}
if (parameters.biome == Biomes.OVERWORLD_TAIGA){
return 2;
}
if (parameters.biome == Biomes.OVERWORLD_PLAINS){
return 3;
}
if (parameters.biome == Biomes.OVERWORLD_CAATINGA || parameters.biome == Biomes.OVERWORLD_CAATINGA_PLAINS){
return 5;
}
if (parameters.biome == Biomes.OVERWORLD_OUTBACK_GRASSY || parameters.biome == Biomes.OVERWORLD_OUTBACK){
return 2;
}
return 0;
}, null, 1f);

biomeFeatures.addFeature(OverworldFunctions::grassTypeCondition, null, (Parameters x) -> overworldConfig.getGrassDensity(x.biome, 0), null, 1);
biomeFeatures.addFeature(new WorldFeatureSpinifexPatch(), 1, 4, new Biome[]{Biomes.OVERWORLD_OUTBACK});
biomeFeatures.addFeature(new WorldFeatureDeadBush(Block.deadbush.id), 1, 2, new Biome[]{Biomes.OVERWORLD_DESERT});
biomeFeatures.addFeature(new WorldFeatureCactus(), 1, 10, new Biome[]{Biomes.OVERWORLD_DESERT});
biomeFeatures.addFeature(new WorldFeatureDeadBush(Block.deadbush.id), 1, 2, new Biome[]{Biomes.OVERWORLD_DESERT, Biomes.OVERWORLD_CAATINGA, Biomes.OVERWORLD_CAATINGA_PLAINS});
biomeFeatures.addFeature(parameters -> new WorldFeatureDeadBush(Block.deadbush.id), null, parameters -> {
if (parameters.biome == Biomes.OVERWORLD_DESERT) {
return 2;
}

if (parameters.biome == Biomes.OVERWORLD_CAATINGA_PLAINS || parameters.biome == Biomes.OVERWORLD_CAATINGA) {
return 1;
}
return 0;
}, null, 1f);
biomeFeatures.addFeature(new WorldFeatureCactus(), 1, 10, new Biome[]{Biomes.OVERWORLD_DESERT, Biomes.OVERWORLD_CAATINGA, Biomes.OVERWORLD_OUTBACK_GRASSY});
}
}

0 comments on commit b07c303

Please sign in to comment.