Rebuild Arrakis strata and bloom attempts with guarded world reset
All checks were successful
DuneRealms Resourcepack CI / resourcepack (push) Successful in 2m16s
DuneRealms Plugin CI / plugins (push) Successful in 2m58s

This commit is contained in:
unimatrixgit 2026-11-29 14:09:19 +01:00
commit 78dea2fb77

View file

@ -98,7 +98,7 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
Block center = findSpiceBlowCenter(block);
if (center != null) {
detonateSpiceBlow(center);
if(actor!=null&&generatedSpiceBlow(center.getX(),center.getZ(),Math.max(256,getConfig().getInt("spice-blow.spacing",2000)))&&center.getType()==Material.GLOWSTONE){
if(actor!=null&&(generatedSpiceBlow(center.getX(),center.getZ(),Math.max(256,getConfig().getInt("spice-blow.spacing",2000)))||ArrakisBlooms.matches(center.getWorld().getSeed(),center.getX(),center.getZ(),Math.max(1,getConfig().getInt("spice-blow.rarity",ArrakisBlooms.DESERT_WELL_RARITY))))&&center.getType()==Material.GLOWSTONE){
UUID reference=UUID.nameUUIDFromBytes((center.getWorld().getUID()+":"+center.getX()+":"+center.getZ()).getBytes(java.nio.charset.StandardCharsets.UTF_8));
FaunaProof.milestone(actor,"husbandry_spice_blow",reference);
}
@ -393,9 +393,13 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
int h = Math.max(minY + 8, Math.min(maxY - 8, baseHeight + (int) Math.round(n * variation)));
heights[x][z] = h;
data.setBlock(x, minY, z, Material.BEDROCK);
for (int y = minY + 1; y < h - 3; y++) data.setBlock(x, y, z, core);
for (int y = h - 3; y < h; y++) data.setBlock(x, y, z, filler);
data.setBlock(x, h, z, surface);
if(planet.equals("arrakis")){
for(int y=minY+1;y<=h;y++)data.setBlock(x,y,z,ArrakisStrata.material(h-y));
}else{
for (int y = minY + 1; y < h - 3; y++) data.setBlock(x, y, z, core);
for (int y = h - 3; y < h; y++) data.setBlock(x, y, z, filler);
data.setBlock(x, h, z, surface);
}
if (plugin.getConfig().getBoolean(path + "water.swamp-pools", false) && h < waterLevel) {
double poolNoise = Math.sin(gx * 0.035) * Math.cos(gz * 0.031);
@ -591,20 +595,20 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
// Dunes stay visibly ordinary sand, including dense-spice areas.
// Preserve suspicious-sand deposits and exposed rock formations.
for(int x=0;x<16;x++)for(int z=0;z<16;z++)for(int y=maxWorldY;y>minWorldY;y--){
var top=data.getType(x,y,z);if(top.isAir())continue;
var top=data.getType(x,y,z);if(ArrakisStrata.air(top))continue;
if(top==Material.RED_SAND||top==Material.ORANGE_TERRACOTTA)data.setBlock(x,y,z,Material.SAND);
break;
}
// Native clay disk profile: one candidate per chunk, radius 2–3,
// half-height 1. Here red sand replaces clay's wet-floor filter.
// Native clay disk geometry: one candidate per chunk, radius 2–3,
// half-height 1, inside sandstone below the four sand layers.
int cx=3+random.nextInt(10),cz=3+random.nextInt(10),radius=2+random.nextInt(2),surface=-1;
for(int y=maxWorldY;y>minWorldY+5;y--)if(!data.getType(cx,y,cz).isAir()){surface=y;break;}
if(surface>minWorldY+5&&data.getType(cx,surface,cz)==Material.SAND&&data.getType(cx,surface-1,cz)==Material.RED_SAND){
int center=surface-3;
for(int y=maxWorldY;y>minWorldY+5;y--)if(!ArrakisStrata.air(data.getType(cx,y,cz))){surface=y;break;}
if(surface>minWorldY+7&&data.getType(cx,surface,cz)==Material.SAND&&data.getType(cx,surface-3,cz)==Material.SAND&&data.getType(cx,surface-4,cz)==Material.SANDSTONE){
int center=surface-5;
for(int dx=-radius;dx<=radius;dx++)for(int dz=-radius;dz<=radius;dz++)if(dx*dx+dz*dz<=radius*radius)for(int dy=-1;dy<=1;dy++){
int x=cx+dx,z=cz+dz,y=center+dy,columnSurface=surface+radius;
while(columnSurface>minWorldY+5&&data.getType(x,columnSurface,z).isAir())columnSurface--;
if(y>columnSurface-2||data.getType(x,columnSurface,z)!=Material.SAND||data.getType(x,columnSurface-1,z)!=Material.RED_SAND)continue;
while(columnSurface>minWorldY+5&&ArrakisStrata.air(data.getType(x,columnSurface,z)))columnSurface--;
if(y>columnSurface-4||data.getType(x,columnSurface,z)!=Material.SAND||data.getType(x,columnSurface-3,z)!=Material.SAND||data.getType(x,columnSurface-4,z)!=Material.SANDSTONE)continue;
var material=data.getType(x,y,z);
if(material==Material.RED_SAND||material==Material.SAND||material==Material.SANDSTONE||material==Material.STONE)data.setBlock(x,y,z,Material.DRIED_KELP_BLOCK);
}
@ -935,15 +939,9 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
@Override public void populate(WorldInfo world, Random random, int chunkX, int chunkZ, LimitedRegion region) {
if (!world.getName().equalsIgnoreCase("arrakis") || !plugin.getConfig().getBoolean("spice-blow.enabled", true)) return;
int spacing = Math.max(256, plugin.getConfig().getInt("spice-blow.spacing", 2000));
long centerX = chunkX * 16L + 8, centerZ = chunkZ * 16L + 8;
long cellX = Math.floorDiv(centerX, spacing), cellZ = Math.floorDiv(centerZ, spacing);
long h1 = mix64(cellX * 0x9E3779B97F4A7C15L ^ cellZ * 0xC2B2AE3D27D4EB4FL ^ SALT);
long h2 = mix64(cellZ * 0x165667B19E3779F9L ^ cellX * 0x85EBCA77C2B2AE63L ^ ~SALT);
long anchorX = cellX * spacing + 8 + Math.floorMod(h1, spacing - 16);
long anchorZ = cellZ * spacing + 8 + Math.floorMod(h2, spacing - 16);
if (Math.floorDiv(anchorX, 16) != chunkX || Math.floorDiv(anchorZ, 16) != chunkZ) return;
int x = (int)anchorX, z = (int)anchorZ, y = region.getHighestBlockYAt(x, z);
var anchor=ArrakisBlooms.anchor(world.getSeed(),chunkX,chunkZ,Math.max(1,plugin.getConfig().getInt("spice-blow.rarity",ArrakisBlooms.DESERT_WELL_RARITY)));
if(anchor==null)return;
int x=anchor.x(),z=anchor.z(),y=region.getHighestBlockYAt(x,z);
if (y < world.getMinHeight() + 2 || y + 2 >= world.getMaxHeight()) return;
if (!region.isInRegion(x, y, z) || region.getType(x, y, z) != Material.SAND) return;
for (int dx = -1; dx <= 1; dx++) for (int dz = -1; dz <= 1; dz++)