Fixes
This commit is contained in:
parent
a968b9bb23
commit
8beabd0f96
18 changed files with 176 additions and 63 deletions
|
@ -16,6 +16,7 @@ public class BiomeFoggyMushroomland extends EndBiome {
|
|||
.addFeature(FeatureRegistry.ENDER_ORE)
|
||||
.addFeature(FeatureRegistry.END_LAKE)
|
||||
.addFeature(FeatureRegistry.MOSSY_GLOWSHROOM)
|
||||
.addFeature(FeatureRegistry.BLUE_VINE)
|
||||
.addFeature(FeatureRegistry.UMBRELLA_MOSS)
|
||||
.addFeature(FeatureRegistry.CREEPING_MOSS));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import ru.betterend.blocks.basis.BlockPlantWithAge;
|
||||
import ru.betterend.registry.BlockRegistry;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
public class BlueVineFeature extends ScatterFeature {
|
||||
private boolean small;
|
||||
|
||||
public BlueVineFeature() {
|
||||
super(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
float d = MHelper.length(center.getX() - blockPos.getX(), center.getZ() - blockPos.getZ()) / radius * 0.6F + random.nextFloat() * 0.4F;
|
||||
small = d > 0.5F;
|
||||
return BlockRegistry.BLUE_VINE_SEED.canPlaceAt(AIR, world, blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
|
||||
if (small) {
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos, BlockRegistry.BLUE_VINE_SEED.getDefaultState().with(BlockPlantWithAge.AGE, random.nextInt(4)));
|
||||
}
|
||||
else {
|
||||
BlockPlantWithAge seed = ((BlockPlantWithAge) BlockRegistry.BLUE_VINE_SEED);
|
||||
seed.grow(world, random, blockPos);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import net.minecraft.structure.rule.BlockMatchRuleTest;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.gen.CountConfig;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.decorator.ChanceDecoratorConfig;
|
||||
import net.minecraft.world.gen.decorator.Decorator;
|
||||
|
@ -72,6 +73,11 @@ public class EndFeature {
|
|||
return newFeature;
|
||||
}
|
||||
|
||||
public static EndFeature makeChunkFeature(String name, Feature<DefaultFeatureConfig> feature) {
|
||||
ConfiguredFeature<?, ?> configured = feature.configure(FeatureConfig.DEFAULT).decorate(Decorator.COUNT.configure(new CountConfig(1)));
|
||||
return new EndFeature(name, feature, GenerationStep.Feature.LOCAL_MODIFICATIONS, configured);
|
||||
}
|
||||
|
||||
public Feature<?> getFeature() {
|
||||
return feature;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Random;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos.Mutable;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
|
@ -50,14 +49,19 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
waterLevel = MHelper.min(pos.getY(), waterLevel);
|
||||
BlockState state;
|
||||
|
||||
int minX = blockPos.getX() - dist2;
|
||||
int maxX = blockPos.getX() + dist2;
|
||||
int minZ = blockPos.getZ() - dist2;
|
||||
int maxZ = blockPos.getZ() + dist2;
|
||||
|
||||
for (int y = blockPos.getY(); y <= blockPos.getY() + 10; y++) {
|
||||
POS.setY(y);
|
||||
int add = y - blockPos.getY();
|
||||
for (int x = blockPos.getX() - dist2; x <= blockPos.getX() + dist2; x++) {
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
POS.setX(x);
|
||||
int x2 = x - blockPos.getX();
|
||||
x2 *= x2;
|
||||
for (int z = blockPos.getZ() - dist2; z <= blockPos.getZ() + dist2; z++) {
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
POS.setZ(z);
|
||||
int z2 = z - blockPos.getZ();
|
||||
z2 *= z2;
|
||||
|
@ -65,7 +69,7 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
r *= r;
|
||||
if (x2 + z2 <= r) {
|
||||
state = world.getBlockState(POS);
|
||||
if (state.isIn(BlockTagRegistry.END_GROUND) || !state.canPlaceAt(world, POS) || state.getMaterial().equals(Material.PLANT)/* || state.getBlock() == BlockRegistry.ENDSTONE_DUST*/) {
|
||||
if (state.isIn(BlockTagRegistry.END_GROUND)) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, AIR);
|
||||
}
|
||||
pos = POS.down();
|
||||
|
@ -79,11 +83,6 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
else
|
||||
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.ENDSTONE_DUST.getDefaultState());
|
||||
}
|
||||
/*pos = POS.up();
|
||||
while (world.getBlockState(pos).isIn(BlockTagRegistry.END_GROUND) || !state.canPlaceAt(world, pos) || state.getBlock() == BlockRegistry.ENDSTONE_DUST) {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, AIR);
|
||||
pos = pos.up();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +107,7 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
rb *= rb;
|
||||
if (y2 + x2 + z2 <= r) {
|
||||
state = world.getBlockState(POS);
|
||||
if (state.isIn(BlockTagRegistry.END_GROUND) || !state.canPlaceAt(world, POS) || state.getBlock() == BlockRegistry.ENDSTONE_DUST) {
|
||||
if (state.isIn(BlockTagRegistry.END_GROUND) || state.getBlock() == BlockRegistry.ENDSTONE_DUST) {
|
||||
BlocksHelper.setWithoutUpdate(world, POS, y < waterLevel ? WATER : AIR);
|
||||
}
|
||||
pos = POS.down();
|
||||
|
@ -139,6 +138,8 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
|
||||
BlocksHelper.fixBlocks(world, new BlockPos(minX - 2, waterLevel - 2, minZ - 2), new BlockPos(maxX + 2, blockPos.getY() + 20, maxZ + 2));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.world.StructureWorldAccess;
|
|||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import ru.betterend.blocks.BlockMossyGlowshroomCap;
|
||||
import ru.betterend.blocks.BlockGlowingFur;
|
||||
import ru.betterend.blocks.basis.BlockGlowingFur;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.BlockRegistry;
|
||||
import ru.betterend.registry.BlockTagRegistry;
|
||||
|
@ -77,10 +77,6 @@ public class MossyGlowshroomFeature extends DefaultFeature {
|
|||
return BlockRegistry.MOSSY_GLOWSHROOM.log.getDefaultState();
|
||||
});
|
||||
Vector3f pos = spline.get(spline.size() - 1);
|
||||
CENTER.set(blockPos.getX(), 0, blockPos.getZ());
|
||||
HEAD_POS.setTranslate(pos.getX(), pos.getY(), pos.getZ());
|
||||
ROOTS_ROT.setAngle(random.nextFloat() * MHelper.PI2);
|
||||
FUNCTION.setSourceA(sdf);
|
||||
float scale = MHelper.randRange(0.75F, 1.1F, random);
|
||||
|
||||
Vector3f vec = spline.get(0);
|
||||
|
@ -112,6 +108,11 @@ public class MossyGlowshroomFeature extends DefaultFeature {
|
|||
}
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos, AIR);
|
||||
|
||||
CENTER.set(blockPos.getX(), 0, blockPos.getZ());
|
||||
HEAD_POS.setTranslate(pos.getX(), pos.getY(), pos.getZ());
|
||||
ROOTS_ROT.setAngle(random.nextFloat() * MHelper.PI2);
|
||||
FUNCTION.setSourceA(sdf);
|
||||
|
||||
Set<BlockPos> blocks = new SDFScale()
|
||||
.setScale(scale)
|
||||
.setSource(FUNCTION)
|
||||
|
@ -187,7 +188,7 @@ public class MossyGlowshroomFeature extends DefaultFeature {
|
|||
FUNCTION = new SDFSmoothUnion().setRadius(4).setSourceB(new SDFUnion().setSourceA(HEAD_POS).setSourceB(ROOTS_ROT));
|
||||
|
||||
REPLACE = (state) -> {
|
||||
if (state.getBlock() != Blocks.END_STONE && state.isIn(BlockTagRegistry.END_GROUND)) {
|
||||
if (state.isIn(BlockTagRegistry.END_GROUND)) {
|
||||
return true;
|
||||
}
|
||||
if (state.getMaterial().equals(Material.PLANT)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue