More fixes, vents generation prototype
This commit is contained in:
parent
a93d7b7ef1
commit
cec37f10d6
5 changed files with 72 additions and 12 deletions
|
@ -7,12 +7,14 @@ 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.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FluidFillable;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.Waterloggable;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
|
@ -30,10 +32,11 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.blocks.basis.BlockBaseNotFull;
|
||||
import ru.betterend.blocks.entities.BlockEntityHydrothermalVent;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
|
||||
public class BlockHydrothermalVent extends BlockBaseNotFull implements FluidFillable, Waterloggable {
|
||||
public class BlockHydrothermalVent extends BlockBaseNotFull implements BlockEntityProvider, FluidFillable, Waterloggable {
|
||||
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
|
||||
private static final VoxelShape SHAPE = Block.createCuboidShape(1, 1, 1, 15, 16, 15);
|
||||
|
||||
|
@ -107,4 +110,9 @@ public class BlockHydrothermalVent extends BlockBaseNotFull implements FluidFill
|
|||
world.addParticle(ParticleTypes.BUBBLE, x, y, z, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity createBlockEntity(BlockView world) {
|
||||
return new BlockEntityHydrothermalVent();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package ru.betterend.blocks.entities;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.util.Tickable;
|
||||
import ru.betterend.blocks.BlockHydrothermalVent;
|
||||
import ru.betterend.registry.EndBlockEntities;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
|
||||
public class BlockEntityHydrothermalVent extends BlockEntity implements Tickable {
|
||||
public BlockEntityHydrothermalVent() {
|
||||
super(EndBlockEntities.HYDROTHERMAL_VENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
double x = pos.getX() + world.random.nextDouble();
|
||||
double y = pos.getY() + 0.9 + world.random.nextDouble() * 0.3;
|
||||
double z = pos.getZ() + world.random.nextDouble();
|
||||
BlockState state = getCachedState();
|
||||
if (state.isOf(EndBlocks.HYDROTHERMAL_VENT)) {
|
||||
if (getCachedState().get(BlockHydrothermalVent.WATERLOGGED)) {
|
||||
world.addParticle(EndParticles.GEYSER_PARTICLE, x, y, z, 0, 0, 0);
|
||||
}
|
||||
else {
|
||||
world.addParticle(ParticleTypes.BUBBLE, x, y, z, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue