Vent particles optimization
This commit is contained in:
parent
329a59c7be
commit
b659424952
6 changed files with 66 additions and 8 deletions
|
@ -15,6 +15,7 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import ru.betterend.blocks.BlockHydrothermalVent;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -150,7 +151,8 @@ public class GeyserFeature extends DefaultFeature {
|
|||
|
||||
for (int i = 0; i < 150; i++) {
|
||||
mut.set(pos).move(MHelper.floor(random.nextGaussian() * 4 + 0.5), -halfHeight - 10, MHelper.floor(random.nextGaussian() * 4 + 0.5));
|
||||
int dist = MHelper.floor(6 - MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ())) + random.nextInt(2);
|
||||
float distRaw = MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ());
|
||||
int dist = MHelper.floor(6 - distRaw) + random.nextInt(2);
|
||||
if (dist >= 0) {
|
||||
BlockState state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
|
@ -162,7 +164,37 @@ public class GeyserFeature extends DefaultFeature {
|
|||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
|
||||
mut.setY(mut.getY() + 1);
|
||||
}
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.HYDROTHERMAL_VENT);
|
||||
state = EndBlocks.HYDROTHERMAL_VENT.getDefaultState().with(BlockHydrothermalVent.ACTIVATED, distRaw < 2);
|
||||
BlocksHelper.setWithoutUpdate(world, mut, state);
|
||||
mut.setY(mut.getY() + 1);
|
||||
state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, Blocks.BUBBLE_COLUMN.getDefaultState().with(BubbleColumnBlock.DRAG, false));
|
||||
world.getBlockTickScheduler().schedule(mut, Blocks.BUBBLE_COLUMN, MHelper.randRange(8, 32, random));
|
||||
mut.setY(mut.getY() + 1);
|
||||
state = world.getBlockState(mut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
mut.set(pos).move(MHelper.floor(random.nextGaussian() * 0.7 + 0.5), -halfHeight - 10, MHelper.floor(random.nextGaussian() * 0.7 + 0.5));
|
||||
float distRaw = MHelper.length(mut.getX() - pos.getX(), mut.getZ() - pos.getZ());
|
||||
int dist = MHelper.floor(6 - distRaw) + random.nextInt(2);
|
||||
if (dist >= 0) {
|
||||
BlockState state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
mut.setY(mut.getY() - 1);
|
||||
state = world.getBlockState(mut);
|
||||
}
|
||||
if (state.isIn(EndTags.GEN_TERRAIN)) {
|
||||
for (int j = 0; j <= dist; j++) {
|
||||
BlocksHelper.setWithoutUpdate(world, mut, EndBlocks.SULPHURIC_ROCK.stone);
|
||||
mut.setY(mut.getY() + 1);
|
||||
}
|
||||
state = EndBlocks.HYDROTHERMAL_VENT.getDefaultState().with(BlockHydrothermalVent.ACTIVATED, distRaw < 2);
|
||||
BlocksHelper.setWithoutUpdate(world, mut, state);
|
||||
mut.setY(mut.getY() + 1);
|
||||
state = world.getBlockState(mut);
|
||||
while (state.isOf(Blocks.WATER)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue