diff --git a/game/core/src/main/java/net/minecraft/core/world/generate/feature/WorldFeatureRubyglassCrystal.java b/game/core/src/main/java/net/minecraft/core/world/generate/feature/WorldFeatureRubyglassCrystal.java index 50415b5d2..adf22cdf2 100644 --- a/game/core/src/main/java/net/minecraft/core/world/generate/feature/WorldFeatureRubyglassCrystal.java +++ b/game/core/src/main/java/net/minecraft/core/world/generate/feature/WorldFeatureRubyglassCrystal.java @@ -103,6 +103,10 @@ public class WorldFeatureRubyglassCrystal implements WorldFeatureInterface { float rx = 0; float ry = 0; + @NotNull final Block column = Blocks.RUBYGLASS_COLUMN; + @NotNull final Block bed = Blocks.COBBLE_NETHERRACK_CRYSTALLINE; + @NotNull final Block node = Blocks.RUBYGLASS_NODE; + final @NotNull TilePos ti = new TilePos(tilePos); ti.y = this.isCeiling ? ti.y + (base / 2) : ti.y - (base / 2); @@ -161,19 +165,38 @@ public class WorldFeatureRubyglassCrystal implements WorldFeatureInterface { return null; } - boolean ore = random.nextInt(50) == 0; - + boolean ore = random.nextInt(100) == 0; + boolean generateBed = false; final float distancePctg = faceDistances[0] / length; + + // Determines if distance is close enough to bottom to generate netherrack base. if (distancePctg < BASE_PCTG) { final float innerDistancePctg = distancePctg / BASE_PCTG; - if (innerDistancePctg < random.nextFloat()) { - return Blocks.COBBLE_NETHERRACK_CRYSTALLINE; - } else { - return ore ? Blocks.RUBYGLASS_NODE : Blocks.RUBYGLASS_COLUMN; + if (innerDistancePctg < random.nextFloat() * 0.75) { + generateBed = true; } - } else { - return ore ? Blocks.RUBYGLASS_NODE : Blocks.RUBYGLASS_COLUMN; } + + // Begin block picking + float minDistToSide = 10; + for(int i = 1; i <= 4; i++) { + minDistToSide = Math.min(faceDistances[i], minDistToSide); + } + + float distFromCenter = maxBase - minDistToSide; + final float distanceToCenterPctg = minDistToSide / maxBase; + + if (distFromCenter > 0.5) + return generateBed ? bed : ore ? node : column; + + + float centerNoise = (float) Math.sin(distanceToCenterPctg * Math.PI * 3) * 0.5f; + float finalNoise = random.nextFloat() + centerNoise; + + if(finalNoise > 0.5){ + return node; + } + return column; } );