Geyser prototype
This commit is contained in:
parent
9504432cdd
commit
bf47e9a2b5
9 changed files with 254 additions and 5 deletions
|
@ -43,7 +43,7 @@ public class BlockBrimstone extends BlockBase {
|
|||
if (deactivate) {
|
||||
world.setBlockState(pos, getDefaultState().with(ACTIVATED, false));
|
||||
}
|
||||
else if (state.get(ACTIVATED)) {
|
||||
else if (state.get(ACTIVATED) && random.nextInt(16) == 0) {
|
||||
Direction dir = BlocksHelper.randomDirection(random);
|
||||
BlockPos side = pos.offset(dir);
|
||||
BlockState sideState = world.getBlockState(side);
|
||||
|
|
69
src/main/java/ru/betterend/blocks/BlockSulphuricGeyser.java
Normal file
69
src/main/java/ru/betterend/blocks/BlockSulphuricGeyser.java
Normal file
|
@ -0,0 +1,69 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FluidFillable;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.blocks.basis.BlockBaseNotFull;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
public class BlockSulphuricGeyser extends BlockBaseNotFull implements FluidFillable {
|
||||
public BlockSulphuricGeyser() {
|
||||
super(FabricBlockSettings.of(Material.STONE)
|
||||
.breakByTool(FabricToolTags.PICKAXES)
|
||||
.sounds(BlockSoundGroup.STONE)
|
||||
.nonOpaque()
|
||||
.requiresTool());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
|
||||
state = world.getBlockState(pos.down());
|
||||
return state.isOf(EndBlocks.SULPHURIC_ROCK.stone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
|
||||
if (!canPlaceAt(state, world, pos)) {
|
||||
return Blocks.WATER.getDefaultState();
|
||||
}
|
||||
else {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||
super.randomDisplayTick(state, world, pos, random);
|
||||
double x = pos.getX() + random.nextDouble();
|
||||
double y = pos.getY() + 0.9 + random.nextDouble() * 0.3;
|
||||
double z = pos.getZ() + random.nextDouble();
|
||||
world.addParticle(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, x, y, z, 0, 0, 0);
|
||||
}
|
||||
}
|
|
@ -39,6 +39,7 @@ import ru.betterend.blocks.BlockPythadendronSapling;
|
|||
import ru.betterend.blocks.BlockShadowBerry;
|
||||
import ru.betterend.blocks.BlockShadowGrass;
|
||||
import ru.betterend.blocks.BlockSulphurCrystal;
|
||||
import ru.betterend.blocks.BlockSulphuricGeyser;
|
||||
import ru.betterend.blocks.BlockTenaneaFlowers;
|
||||
import ru.betterend.blocks.BlockTenaneaSapling;
|
||||
import ru.betterend.blocks.BlockTerrain;
|
||||
|
@ -111,6 +112,8 @@ public class EndBlocks {
|
|||
public static final Block QUARTZ_PEDESTAL = registerBlock("quartz_pedestal", new PedestalVanilla(Blocks.QUARTZ_BLOCK));
|
||||
public static final Block PURPUR_PEDESTAL = registerBlock("purpur_pedestal", new PedestalVanilla(Blocks.PURPUR_BLOCK));
|
||||
|
||||
public static final Block SULPHURIC_GEYSER = registerBlock("sulphuric_geyser", new BlockSulphuricGeyser());
|
||||
|
||||
// Wooden Materials And Trees //
|
||||
public static final Block MOSSY_GLOWSHROOM_SAPLING = registerBlock("mossy_glowshroom_sapling", new BlockMossyGlowshroomSapling());
|
||||
public static final Block MOSSY_GLOWSHROOM_CAP = registerBlock("mossy_glowshroom_cap", new BlockMossyGlowshroomCap());
|
||||
|
@ -209,7 +212,7 @@ public class EndBlocks {
|
|||
public static final Block ETERNAL_PEDESTAL = registerBlock("eternal_pedestal", new EternalPedestal());
|
||||
public static final Block INFUSION_PEDESTAL = registerBlock("infusion_pedestal", new InfusionPedestal());
|
||||
|
||||
//Technical
|
||||
// Technical
|
||||
public static final Block END_PORTAL_BLOCK = registerBlockNI("end_portal_block", new EndPortalBlock());
|
||||
|
||||
public static void register() {}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
else if (dist < r2 * r2) {
|
||||
if (world.getBlockState(bpos).isIn(EndTags.GEN_TERRAIN)) {
|
||||
double v = noise.eval(x * 0.1, y * 0.1, z * 0.1) + noise.eval(x * 0.03, y * 0.03, z * 0.03) * 0.5;
|
||||
if (v < 0) {
|
||||
if (v > 0.4) {
|
||||
brimstone.add(bpos.toImmutable());
|
||||
}
|
||||
else {
|
||||
|
@ -129,7 +129,7 @@ public class SulphuricCaveFeature extends DefaultFeature {
|
|||
private void makeShards(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
for (Direction dir: BlocksHelper.DIRECTIONS) {
|
||||
BlockPos side;
|
||||
if (random.nextInt(3) == 0 && world.getBlockState((side = pos.offset(dir))).isOf(Blocks.WATER)) {
|
||||
if (random.nextInt(16) == 0 && world.getBlockState((side = pos.offset(dir))).isOf(Blocks.WATER)) {
|
||||
BlockState state = EndBlocks.SULPHUR_CRYSTAL.getDefaultState()
|
||||
.with(BlockSulphurCrystal.WATERLOGGED, true)
|
||||
.with(BlockSulphurCrystal.FACING, dir)
|
||||
|
|
|
@ -193,7 +193,7 @@ public class SulphuricLakeFeature extends DefaultFeature {
|
|||
private void makeShards(StructureWorldAccess world, BlockPos pos, Random random) {
|
||||
for (Direction dir: BlocksHelper.DIRECTIONS) {
|
||||
BlockPos side;
|
||||
if (random.nextInt(3) == 0 && world.getBlockState((side = pos.offset(dir))).isOf(Blocks.WATER)) {
|
||||
if (random.nextInt(16) == 0 && world.getBlockState((side = pos.offset(dir))).isOf(Blocks.WATER)) {
|
||||
BlockState state = EndBlocks.SULPHUR_CRYSTAL.getDefaultState()
|
||||
.with(BlockSulphurCrystal.WATERLOGGED, true)
|
||||
.with(BlockSulphurCrystal.FACING, dir)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue