Some Biome Work
This commit is contained in:
parent
02e43f9eb6
commit
1909aea351
13 changed files with 385 additions and 72 deletions
|
@ -1,15 +1,22 @@
|
||||||
package org.betterx.betterend.world.biome.land;
|
package org.betterx.betterend.world.biome.land;
|
||||||
|
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.surface.SurfaceRuleBuilder;
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.surface.rules.SwitchRuleSource;
|
||||||
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
|
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
|
||||||
import org.betterx.betterend.registry.EndBlocks;
|
import org.betterx.betterend.registry.EndBlocks;
|
||||||
import org.betterx.betterend.registry.EndFeatures;
|
import org.betterx.betterend.registry.EndFeatures;
|
||||||
import org.betterx.betterend.registry.EndSounds;
|
import org.betterx.betterend.registry.EndSounds;
|
||||||
import org.betterx.betterend.registry.EndStructures;
|
import org.betterx.betterend.registry.EndStructures;
|
||||||
import org.betterx.betterend.world.biome.EndBiome;
|
import org.betterx.betterend.world.biome.EndBiome;
|
||||||
|
import org.betterx.betterend.world.surface.SplitNoiseCondition;
|
||||||
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CrystalMountainsBiome extends EndBiome.Config {
|
public class CrystalMountainsBiome extends EndBiome.Config {
|
||||||
public CrystalMountainsBiome() {
|
public CrystalMountainsBiome() {
|
||||||
|
@ -33,6 +40,20 @@ public class CrystalMountainsBiome extends EndBiome.Config {
|
||||||
public BlockState getTopMaterial() {
|
public BlockState getTopMaterial() {
|
||||||
return EndBlocks.CRYSTAL_MOSS.defaultBlockState();
|
return EndBlocks.CRYSTAL_MOSS.defaultBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SurfaceRuleBuilder surface() {
|
||||||
|
SurfaceRules.RuleSource surfaceBlockRule = new SwitchRuleSource(
|
||||||
|
new SplitNoiseCondition(),
|
||||||
|
List.of(
|
||||||
|
SurfaceRules.state(EndBlocks.END_MOSS.defaultBlockState()),
|
||||||
|
SurfaceRules.state(Blocks.END_STONE.defaultBlockState())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return super
|
||||||
|
.surface()
|
||||||
|
.rule(1, SurfaceRules.ifTrue(SurfaceRules.ON_FLOOR, surfaceBlockRule));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
package org.betterx.betterend.world.biome.land;
|
package org.betterx.betterend.world.biome.land;
|
||||||
|
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.surface.SurfaceRuleBuilder;
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.surface.rules.SwitchRuleSource;
|
||||||
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
|
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
|
||||||
import org.betterx.betterend.registry.EndBlocks;
|
import org.betterx.betterend.registry.EndBlocks;
|
||||||
import org.betterx.betterend.registry.EndSounds;
|
import org.betterx.betterend.registry.EndSounds;
|
||||||
import org.betterx.betterend.registry.EndStructures;
|
import org.betterx.betterend.registry.EndStructures;
|
||||||
import org.betterx.betterend.world.biome.EndBiome;
|
import org.betterx.betterend.world.biome.EndBiome;
|
||||||
|
import org.betterx.betterend.world.surface.VerticalBandNoiseCondition;
|
||||||
|
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PaintedMountainsBiome extends EndBiome.Config {
|
public class PaintedMountainsBiome extends EndBiome.Config {
|
||||||
public PaintedMountainsBiome() {
|
public PaintedMountainsBiome() {
|
||||||
|
@ -36,6 +43,18 @@ public class PaintedMountainsBiome extends EndBiome.Config {
|
||||||
public BlockState getTopMaterial() {
|
public BlockState getTopMaterial() {
|
||||||
return EndBlocks.ENDSTONE_DUST.defaultBlockState();
|
return EndBlocks.ENDSTONE_DUST.defaultBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SurfaceRuleBuilder surface() {
|
||||||
|
SurfaceRules.RuleSource surfaceBlockRule = new SwitchRuleSource(
|
||||||
|
VerticalBandNoiseCondition.DEFAULT,
|
||||||
|
List.of(
|
||||||
|
SurfaceRules.state(Blocks.END_STONE.defaultBlockState()),
|
||||||
|
SurfaceRules.state(EndBlocks.FLAVOLITE.stone.defaultBlockState()),
|
||||||
|
SurfaceRules.state(EndBlocks.VIOLECITE.stone.defaultBlockState())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return SurfaceRuleBuilder.start().rule(9, surfaceBlockRule);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public abstract class FeatureBaseStructure extends Structure {
|
||||||
context.heightAccessor(),
|
context.heightAccessor(),
|
||||||
context.randomState()
|
context.randomState()
|
||||||
);
|
);
|
||||||
if (pos.getZ() >= 20) {
|
if (pos.getY() >= 10) {
|
||||||
return Optional.of(new Structure.GenerationStub(pos, (structurePiecesBuilder) -> {
|
return Optional.of(new Structure.GenerationStub(pos, (structurePiecesBuilder) -> {
|
||||||
generatePieces(structurePiecesBuilder, context);
|
generatePieces(structurePiecesBuilder, context);
|
||||||
}));
|
}));
|
||||||
|
@ -58,46 +58,36 @@ public abstract class FeatureBaseStructure extends Structure {
|
||||||
LegacyRandomSource random = new LegacyRandomSource(chunkPos.x + chunkPos.z * 10387313);
|
LegacyRandomSource random = new LegacyRandomSource(chunkPos.x + chunkPos.z * 10387313);
|
||||||
Rotation blockRotation = Rotation.getRandom(random);
|
Rotation blockRotation = Rotation.getRandom(random);
|
||||||
|
|
||||||
int i = 5;
|
int offsetX = 5;
|
||||||
int j = 5;
|
int offsetZ = 5;
|
||||||
if (blockRotation == Rotation.CLOCKWISE_90) {
|
if (blockRotation == Rotation.CLOCKWISE_90) {
|
||||||
i = -5;
|
offsetX = -5;
|
||||||
} else if (blockRotation == Rotation.CLOCKWISE_180) {
|
} else if (blockRotation == Rotation.CLOCKWISE_180) {
|
||||||
i = -5;
|
offsetX = -5;
|
||||||
j = -5;
|
offsetZ = -5;
|
||||||
} else if (blockRotation == Rotation.COUNTERCLOCKWISE_90) {
|
} else if (blockRotation == Rotation.COUNTERCLOCKWISE_90) {
|
||||||
j = -5;
|
offsetZ = -5;
|
||||||
}
|
}
|
||||||
|
|
||||||
int k = chunkPos.getBlockX(7);
|
int blockX = chunkPos.getBlockX(7);
|
||||||
int l = chunkPos.getBlockZ(7);
|
int blockZ = chunkPos.getBlockZ(7);
|
||||||
int m = chunkGenerator.getFirstOccupiedHeight(
|
int minZ = Integer.MAX_VALUE;
|
||||||
k,
|
BlockPos.MutableBlockPos result = new BlockPos.MutableBlockPos(blockX, Integer.MIN_VALUE, blockZ);
|
||||||
l,
|
for (int i = 0; i < 2; i++) {
|
||||||
|
for (int j = 0; j < 2; j++) {
|
||||||
|
int z = chunkGenerator.getFirstOccupiedHeight(
|
||||||
|
blockX + i * offsetX,
|
||||||
|
blockZ + j * offsetZ,
|
||||||
Heightmap.Types.WORLD_SURFACE_WG,
|
Heightmap.Types.WORLD_SURFACE_WG,
|
||||||
levelHeightAccessor,
|
levelHeightAccessor,
|
||||||
rState
|
rState
|
||||||
);
|
);
|
||||||
int n = chunkGenerator.getFirstOccupiedHeight(
|
if (z < minZ) {
|
||||||
k,
|
result.set(blockX + i * offsetX, z, blockZ + j * offsetZ);
|
||||||
l + j,
|
}
|
||||||
Heightmap.Types.WORLD_SURFACE_WG,
|
}
|
||||||
levelHeightAccessor,
|
}
|
||||||
rState
|
|
||||||
);
|
return result;
|
||||||
int o = chunkGenerator.getFirstOccupiedHeight(
|
|
||||||
k + i,
|
|
||||||
l,
|
|
||||||
Heightmap.Types.WORLD_SURFACE_WG,
|
|
||||||
levelHeightAccessor,
|
|
||||||
rState
|
|
||||||
);
|
|
||||||
int p = chunkGenerator.getFirstOccupiedHeight(
|
|
||||||
k + i,
|
|
||||||
l + j,
|
|
||||||
Heightmap.Types.WORLD_SURFACE_WG,
|
|
||||||
levelHeightAccessor, rState
|
|
||||||
);
|
|
||||||
return new BlockPos(k, l, Math.min(Math.min(m, n), Math.min(o, p)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.world.level.levelgen.structure.StructureType;
|
||||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder;
|
import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder;
|
||||||
|
|
||||||
public class PaintedMountainStructure extends FeatureBaseStructure {
|
public class PaintedMountainStructure extends FeatureBaseStructure {
|
||||||
private static final BlockState[] VARIANTS;
|
public static final BlockState[] VARIANTS;
|
||||||
|
|
||||||
public PaintedMountainStructure(StructureSettings s) {
|
public PaintedMountainStructure(StructureSettings s) {
|
||||||
super(s);
|
super(s);
|
||||||
|
@ -46,9 +46,9 @@ public class PaintedMountainStructure extends FeatureBaseStructure {
|
||||||
float radius = MHelper.randRange(50, 100, random);
|
float radius = MHelper.randRange(50, 100, random);
|
||||||
float height = radius * MHelper.randRange(0.4F, 0.6F, random);
|
float height = radius * MHelper.randRange(0.4F, 0.6F, random);
|
||||||
int count = MHelper.floor(height * MHelper.randRange(0.1F, 0.35F, random) + 1);
|
int count = MHelper.floor(height * MHelper.randRange(0.1F, 0.35F, random) + 1);
|
||||||
BlockState[] slises = new BlockState[count];
|
BlockState[] slices = new BlockState[count];
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
slises[i] = VARIANTS[random.nextInt(VARIANTS.length)];
|
slices[i] = VARIANTS[random.nextInt(VARIANTS.length)];
|
||||||
}
|
}
|
||||||
structurePiecesBuilder.addPiece(new PaintedMountainPiece(
|
structurePiecesBuilder.addPiece(new PaintedMountainPiece(
|
||||||
new BlockPos(x, y, z),
|
new BlockPos(x, y, z),
|
||||||
|
@ -56,7 +56,7 @@ public class PaintedMountainStructure extends FeatureBaseStructure {
|
||||||
height,
|
height,
|
||||||
random,
|
random,
|
||||||
biome,
|
biome,
|
||||||
slises
|
slices
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package org.betterx.betterend.world.structures.piece;
|
package org.betterx.betterend.world.structures.piece;
|
||||||
|
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
|
|
||||||
import org.betterx.bclib.util.MHelper;
|
import org.betterx.bclib.util.MHelper;
|
||||||
import org.betterx.betterend.registry.EndBlocks;
|
import org.betterx.betterend.registry.EndBlocks;
|
||||||
import org.betterx.betterend.registry.EndStructures;
|
import org.betterx.betterend.registry.EndStructures;
|
||||||
import org.betterx.betterend.util.GlobalState;
|
import org.betterx.betterend.util.GlobalState;
|
||||||
import org.betterx.betterend.world.biome.EndBiome;
|
import org.betterx.betterend.world.surface.SplitNoiseCondition;
|
||||||
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
|
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -32,7 +31,7 @@ public class CrystalMountainPiece extends MountainPiece {
|
||||||
|
|
||||||
public CrystalMountainPiece(BlockPos center, float radius, float height, RandomSource random, Holder<Biome> biome) {
|
public CrystalMountainPiece(BlockPos center, float radius, float height, RandomSource random, Holder<Biome> biome) {
|
||||||
super(EndStructures.MOUNTAIN_PIECE, center, radius, height, random, biome);
|
super(EndStructures.MOUNTAIN_PIECE, center, radius, height, random, biome);
|
||||||
top = EndBiome.findTopMaterial(biome.value()); //biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
top = EndBlocks.CRYSTAL_MOSS.defaultBlockState(); //EndBiome.findTopMaterial(biome.value()); //biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrystalMountainPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
public CrystalMountainPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||||
|
@ -42,7 +41,7 @@ public class CrystalMountainPiece extends MountainPiece {
|
||||||
@Override
|
@Override
|
||||||
protected void fromNbt(CompoundTag tag) {
|
protected void fromNbt(CompoundTag tag) {
|
||||||
super.fromNbt(tag);
|
super.fromNbt(tag);
|
||||||
top = EndBiome.findTopMaterial(BiomeAPI.getBiome(biomeID)); //BiomeAPI.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
//top = EndBiome.findTopMaterial(BiomeAPI.getBiome(biomeID)); //BiomeAPI.getBiome(biomeID).getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -79,9 +78,10 @@ public class CrystalMountainPiece extends MountainPiece {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pos.setY(minY);
|
pos.setY(minY);
|
||||||
while (!chunk.getBlockState(pos)
|
while (!chunk.getBlockState(pos).is(CommonBlockTags.GEN_END_STONES)
|
||||||
.is(CommonBlockTags.GEN_END_STONES) && pos.getY() > 56 && !chunk.getBlockState(
|
&& pos.getY() > 56
|
||||||
pos.below()).is(Blocks.CAVE_AIR)) {
|
&& chunk.getBlockState(pos.below()).is(Blocks.CAVE_AIR)
|
||||||
|
) {
|
||||||
pos.setY(pos.getY() - 1);
|
pos.setY(pos.getY() - 1);
|
||||||
}
|
}
|
||||||
minY = pos.getY();
|
minY = pos.getY();
|
||||||
|
@ -94,18 +94,20 @@ public class CrystalMountainPiece extends MountainPiece {
|
||||||
maxY += center.getY();
|
maxY += center.getY();
|
||||||
int maxYI = (int) (maxY);
|
int maxYI = (int) (maxY);
|
||||||
int cover = maxYI - 1;
|
int cover = maxYI - 1;
|
||||||
boolean needCover = (noise1.eval(px * 0.1, pz * 0.1) + MHelper.randRange(
|
|
||||||
-0.4,
|
final double noise = SplitNoiseCondition.DEFAULT.getNoise(px, pz);
|
||||||
0.4,
|
boolean needCover = noise > 0;
|
||||||
random
|
boolean needSurroundCover = noise > -0.2;
|
||||||
) - (center.getY() + 14) * 0.1) > 0;
|
|
||||||
for (int y = minY - 1; y < maxYI; y++) {
|
for (int y = minY - 1; y < maxYI; y++) {
|
||||||
pos.setY(y);
|
pos.setY(y);
|
||||||
chunk.setBlockState(
|
if (needCover && y == cover) {
|
||||||
pos,
|
chunk.setBlockState(pos, top, false);
|
||||||
needCover && y == cover ? top : Blocks.END_STONE.defaultBlockState(),
|
} else {
|
||||||
false
|
chunk.setBlockState(pos, Blocks.END_STONE.defaultBlockState(), false);
|
||||||
);
|
if (needSurroundCover) {
|
||||||
|
chunk.setBlockState(pos.above(), Blocks.SCULK_VEIN.defaultBlockState(), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +126,7 @@ public class CrystalMountainPiece extends MountainPiece {
|
||||||
int x = MHelper.randRange(radius, 15 - radius, random);
|
int x = MHelper.randRange(radius, 15 - radius, random);
|
||||||
int z = MHelper.randRange(radius, 15 - radius, random);
|
int z = MHelper.randRange(radius, 15 - radius, random);
|
||||||
int y = map.getFirstAvailable(x, z);
|
int y = map.getFirstAvailable(x, z);
|
||||||
if (y > 80) {
|
if (y > 60) {
|
||||||
pos.set(x, y, z);
|
pos.set(x, y, z);
|
||||||
if (chunk.getBlockState(pos.below()).is(Blocks.END_STONE)) {
|
if (chunk.getBlockState(pos.below()).is(Blocks.END_STONE)) {
|
||||||
int height = MHelper.floor(radius * MHelper.randRange(1.5F, 3F, random) + (y - 80) * 0.3F);
|
int height = MHelper.floor(radius * MHelper.randRange(1.5F, 3F, random) + (y - 80) * 0.3F);
|
||||||
|
@ -142,7 +144,7 @@ public class CrystalMountainPiece extends MountainPiece {
|
||||||
int x = MHelper.randRange(radius, 15 - radius, random);
|
int x = MHelper.randRange(radius, 15 - radius, random);
|
||||||
int z = MHelper.randRange(radius, 15 - radius, random);
|
int z = MHelper.randRange(radius, 15 - radius, random);
|
||||||
int y = map.getFirstAvailable(x, z);
|
int y = map.getFirstAvailable(x, z);
|
||||||
if (y > 80) {
|
if (y > 20) {
|
||||||
pos.set(x, y, z);
|
pos.set(x, y, z);
|
||||||
if (chunk.getBlockState(pos.below()).getBlock() == Blocks.END_STONE) {
|
if (chunk.getBlockState(pos.below()).getBlock() == Blocks.END_STONE) {
|
||||||
int height = MHelper.floor(radius * MHelper.randRange(1.5F, 3F, random) + (y - 80) * 0.3F);
|
int height = MHelper.floor(radius * MHelper.randRange(1.5F, 3F, random) + (y - 80) * 0.3F);
|
||||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||||
|
|
||||||
public class PaintedMountainPiece extends MountainPiece {
|
public class PaintedMountainPiece extends MountainPiece {
|
||||||
private BlockState[] slises;
|
private BlockState[] slices;
|
||||||
|
|
||||||
public PaintedMountainPiece(
|
public PaintedMountainPiece(
|
||||||
BlockPos center,
|
BlockPos center,
|
||||||
|
@ -32,10 +32,10 @@ public class PaintedMountainPiece extends MountainPiece {
|
||||||
float height,
|
float height,
|
||||||
RandomSource random,
|
RandomSource random,
|
||||||
Holder<Biome> biome,
|
Holder<Biome> biome,
|
||||||
BlockState[] slises
|
BlockState[] slices
|
||||||
) {
|
) {
|
||||||
super(EndStructures.PAINTED_MOUNTAIN_PIECE, center, radius, height, random, biome);
|
super(EndStructures.PAINTED_MOUNTAIN_PIECE, center, radius, height, random, biome);
|
||||||
this.slises = slises;
|
this.slices = slices;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaintedMountainPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
public PaintedMountainPiece(StructurePieceSerializationContext type, CompoundTag tag) {
|
||||||
|
@ -45,20 +45,20 @@ public class PaintedMountainPiece extends MountainPiece {
|
||||||
@Override
|
@Override
|
||||||
protected void addAdditionalSaveData(CompoundTag tag) {
|
protected void addAdditionalSaveData(CompoundTag tag) {
|
||||||
super.addAdditionalSaveData(tag);
|
super.addAdditionalSaveData(tag);
|
||||||
ListTag slise = new ListTag();
|
ListTag slice = new ListTag();
|
||||||
for (BlockState state : slises) {
|
for (BlockState state : slices) {
|
||||||
slise.add(NbtUtils.writeBlockState(state));
|
slice.add(NbtUtils.writeBlockState(state));
|
||||||
}
|
}
|
||||||
tag.put("slises", slise);
|
tag.put("slises", slice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void fromNbt(CompoundTag tag) {
|
protected void fromNbt(CompoundTag tag) {
|
||||||
super.fromNbt(tag);
|
super.fromNbt(tag);
|
||||||
ListTag slise = tag.getList("slises", 10);
|
ListTag slise = tag.getList("slises", 10);
|
||||||
slises = new BlockState[slise.size()];
|
slices = new BlockState[slise.size()];
|
||||||
for (int i = 0; i < slises.length; i++) {
|
for (int i = 0; i < slices.length; i++) {
|
||||||
slises[i] = NbtUtils.readBlockState(slise.getCompound(i));
|
slices[i] = NbtUtils.readBlockState(slise.getCompound(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ public class PaintedMountainPiece extends MountainPiece {
|
||||||
) * 2 + 7);
|
) * 2 + 7);
|
||||||
for (int y = minY - 1; y < maxY; y++) {
|
for (int y = minY - 1; y < maxY; y++) {
|
||||||
pos.setY(y);
|
pos.setY(y);
|
||||||
int index = MHelper.floor((y + offset) * 0.65F) % slises.length;
|
int index = MHelper.floor((y + offset) * 0.65F) % slices.length;
|
||||||
chunk.setBlockState(pos, slises[index], false);
|
chunk.setBlockState(pos, slices[index], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,16 @@ public class SplitNoiseCondition implements NumericProvider {
|
||||||
return noise > 0 ? 1 : 0;
|
return noise > 0 ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getNoise(int x, int z) {
|
||||||
|
float noise = (float) NOISE.eval(x * 0.1, z * 0.1) + MHelper.randRange(
|
||||||
|
-0.2F,
|
||||||
|
0.2F,
|
||||||
|
MHelper.RANDOM_SOURCE
|
||||||
|
);
|
||||||
|
return noise;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Codec<? extends NumericProvider> pcodec() {
|
public Codec<? extends NumericProvider> pcodec() {
|
||||||
return CODEC;
|
return CODEC;
|
||||||
|
|
|
@ -49,5 +49,11 @@ public class SulphuricSurfaceNoiseCondition implements NumericProvider {
|
||||||
BetterEnd.makeID("sulphuric_surf"),
|
BetterEnd.makeID("sulphuric_surf"),
|
||||||
SulphuricSurfaceNoiseCondition.CODEC
|
SulphuricSurfaceNoiseCondition.CODEC
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Registry.register(
|
||||||
|
NumericProvider.NUMERIC_PROVIDER,
|
||||||
|
BetterEnd.makeID("vertical_band"),
|
||||||
|
VerticalBandNoiseCondition.CODEC
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
package org.betterx.betterend.world.surface;
|
||||||
|
|
||||||
|
import org.betterx.bclib.interfaces.NumericProvider;
|
||||||
|
import org.betterx.bclib.mixin.common.SurfaceRulesContextAccessor;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.world.level.levelgen.Noises;
|
||||||
|
import net.minecraft.world.level.levelgen.synth.NormalNoise;
|
||||||
|
|
||||||
|
public class VerticalBandNoiseCondition implements NumericProvider {
|
||||||
|
public static final VerticalBandNoiseCondition DEFAULT = new VerticalBandNoiseCondition(
|
||||||
|
Noises.CLAY_BANDS_OFFSET,
|
||||||
|
4.0,
|
||||||
|
4.0,
|
||||||
|
6.0,
|
||||||
|
1.3
|
||||||
|
);
|
||||||
|
public static final Codec<VerticalBandNoiseCondition> CODEC = RecordCodecBuilder.create(instance -> instance
|
||||||
|
.group(
|
||||||
|
ResourceKey.codec(Registry.NOISE_REGISTRY).fieldOf("noise").forGetter(o -> o.noise),
|
||||||
|
Codec.DOUBLE.fieldOf("offset_scale").orElse(4.0).forGetter(o -> o.offsetScale),
|
||||||
|
Codec.DOUBLE.fieldOf("band_scale").orElse(4.0).forGetter(o -> o.bandScale),
|
||||||
|
Codec.DOUBLE.fieldOf("xz_scale").orElse(6.0).forGetter(o -> o.xzScale),
|
||||||
|
Codec.DOUBLE.fieldOf("y_scale").orElse(1.3).forGetter(o -> o.yScale)
|
||||||
|
)
|
||||||
|
.apply(instance, VerticalBandNoiseCondition::new));
|
||||||
|
|
||||||
|
private final ResourceKey<NormalNoise.NoiseParameters> noise;
|
||||||
|
private final double offsetScale;
|
||||||
|
private final double bandScale;
|
||||||
|
private final double xzScale;
|
||||||
|
private final double yScale;
|
||||||
|
|
||||||
|
public VerticalBandNoiseCondition(
|
||||||
|
ResourceKey<NormalNoise.NoiseParameters> noise,
|
||||||
|
double offsetScale,
|
||||||
|
double bandScale,
|
||||||
|
double xzScale,
|
||||||
|
double yScale
|
||||||
|
) {
|
||||||
|
this.noise = noise;
|
||||||
|
this.offsetScale = offsetScale;
|
||||||
|
this.bandScale = bandScale;
|
||||||
|
this.xzScale = xzScale;
|
||||||
|
this.yScale = yScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNumber(SurfaceRulesContextAccessor context) {
|
||||||
|
final NormalNoise normalNoise = context.getRandomState().getOrCreateNoise(this.noise);
|
||||||
|
double offset = normalNoise.getValue(
|
||||||
|
(double) context.getBlockX() * xzScale,
|
||||||
|
context.getBlockY() * yScale * 10,
|
||||||
|
(double) context.getBlockZ() * xzScale
|
||||||
|
) * offsetScale;
|
||||||
|
|
||||||
|
|
||||||
|
return (int) (context.getBlockY() / bandScale + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Codec<? extends NumericProvider> pcodec() {
|
||||||
|
return CODEC;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
{
|
||||||
|
"multipart": [
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover"
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"north": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover"
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"down": "false",
|
||||||
|
"east": "false",
|
||||||
|
"north": "false",
|
||||||
|
"south": "false",
|
||||||
|
"up": "false",
|
||||||
|
"west": "false"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover",
|
||||||
|
"uvlock": true,
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"east": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover",
|
||||||
|
"uvlock": true,
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"down": "false",
|
||||||
|
"east": "false",
|
||||||
|
"north": "false",
|
||||||
|
"south": "false",
|
||||||
|
"up": "false",
|
||||||
|
"west": "false"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover",
|
||||||
|
"uvlock": true,
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"south": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover",
|
||||||
|
"uvlock": true,
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"down": "false",
|
||||||
|
"east": "false",
|
||||||
|
"north": "false",
|
||||||
|
"south": "false",
|
||||||
|
"up": "false",
|
||||||
|
"west": "false"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover",
|
||||||
|
"uvlock": true,
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"west": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover",
|
||||||
|
"uvlock": true,
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"down": "false",
|
||||||
|
"east": "false",
|
||||||
|
"north": "false",
|
||||||
|
"south": "false",
|
||||||
|
"up": "false",
|
||||||
|
"west": "false"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover",
|
||||||
|
"uvlock": true,
|
||||||
|
"x": 270
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"up": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover",
|
||||||
|
"uvlock": true,
|
||||||
|
"x": 270
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"down": "false",
|
||||||
|
"east": "false",
|
||||||
|
"north": "false",
|
||||||
|
"south": "false",
|
||||||
|
"up": "false",
|
||||||
|
"west": "false"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover",
|
||||||
|
"uvlock": true,
|
||||||
|
"x": 90
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"down": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apply": {
|
||||||
|
"model": "betterend:block/crystal_moss_cover",
|
||||||
|
"uvlock": true,
|
||||||
|
"x": 90
|
||||||
|
},
|
||||||
|
"when": {
|
||||||
|
"down": "false",
|
||||||
|
"east": "false",
|
||||||
|
"north": "false",
|
||||||
|
"south": "false",
|
||||||
|
"up": "false",
|
||||||
|
"west": "false"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
"ambientocclusion": false,
|
||||||
|
"textures": {
|
||||||
|
"particle": "betterend:block/crystal_moss_cover",
|
||||||
|
"cover": "betterend:block/crystal_moss_cover"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"from": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
16,
|
||||||
|
16,
|
||||||
|
0.1
|
||||||
|
],
|
||||||
|
"faces": {
|
||||||
|
"north": {
|
||||||
|
"uv": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
16,
|
||||||
|
16
|
||||||
|
],
|
||||||
|
"texture": "#cover"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"uv": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
16,
|
||||||
|
16
|
||||||
|
],
|
||||||
|
"texture": "#cover"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"animation": {
|
||||||
|
"frametime": 20,
|
||||||
|
"interpolate": true
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 759 B |
Loading…
Add table
Add a link
Reference in a new issue