Skip to content

Commit

Permalink
Tree Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
UselessBullets committed Nov 10, 2023
1 parent 2336b7b commit 055f5f9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ public static Integer getTreeDensity(Parameters parameters){
}
return treeDensity/2;
}
/**Vanilla tree generator
* @param parameters Parameters Container

/**Vanilla hell tree generator
* @param parameters Parameters Container, takes two custom parameters getTreeFeature function and getTreeDensity function
* @return null
*/
public static Void generateTrees(Parameters parameters){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,20 @@ public static Void generateRandomFluid(Parameters parameters){
}
return null;
}

/**Vanilla tree generator
* @param parameters Parameters Container, takes two custom parameters getTreeFeature function and getTreeDensity function
* @return null
*/
public static Void generateTrees(Parameters parameters){
int x = parameters.chunk.xPosition * 16;
int z = parameters.chunk.zPosition * 16;
for (int i = 0; i < getTreeDensity(parameters); i++) {
int xf = x + parameters.random.nextInt(16) + 8;
int zf = z + parameters.random.nextInt(16) + 8;
int yf = parameters.decorator.world.getHeightValue(xf, zf);
getTreeFeature(parameters).generate(parameters.decorator.world, parameters.random, xf, yf, zf);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,20 @@ public static Integer getTreeDensity(Parameters parameters){
}
return density;
}

/**Vanilla tree generator
* @param parameters Parameters Container, takes two custom parameters getTreeFeature function and getTreeDensity function
* @return null
*/
public static Void generateTrees(Parameters parameters){
int x = parameters.chunk.xPosition * 16;
int z = parameters.chunk.zPosition * 16;
for (int i = 0; i < getTreeDensity(parameters); i++) {
int xf = x + parameters.random.nextInt(16) + 8;
int zf = z + parameters.random.nextInt(16) + 8;
int yf = parameters.decorator.world.getHeightValue(xf, zf);
getTreeFeature(parameters).generate(parameters.decorator.world, parameters.random, xf, yf, zf);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ protected void initValues() {
@Override
protected void initStructure() {
structureFeatures.addFeature(RetroFunctions::generateDungeon, null);
structureFeatures.addFeature(RetroFunctions::generateTrees, null);
structureFeatures.addFeature(OverworldFunctions::generateRandomFluid, new Object[]{50, Block.fluidWaterFlowing.id});
structureFeatures.addFeature(OverworldFunctions::generateRandomFluid, new Object[]{20, Block.fluidLavaFlowing.id});
}
Expand All @@ -56,7 +57,6 @@ protected void initRandom() {

@Override
protected void initBiome() {
biomeFeatures.addFeature(RetroFunctions::getTreeFeature, null, RetroFunctions::getTreeDensity, null, -1);
biomeFeatures.addFeature(new WorldFeatureFlowers(Block.flowerYellow.id), 1, 2, null);
biomeFeatures.addFeature(new WorldFeatureSugarCane(), 1, 10, null);
biomeFeatures.addFeature(new WorldFeatureCactus(), 1, 1, null);
Expand Down

0 comments on commit 055f5f9

Please sign in to comment.