Geyser fixes
This commit is contained in:
parent
bf47e9a2b5
commit
6ee49ed3e6
1 changed files with 37 additions and 2 deletions
|
@ -6,16 +6,25 @@ import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.FluidFillable;
|
import net.minecraft.block.FluidFillable;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
|
import net.minecraft.block.ShapeContext;
|
||||||
|
import net.minecraft.block.Waterloggable;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.fluid.FluidState;
|
import net.minecraft.fluid.FluidState;
|
||||||
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.sound.BlockSoundGroup;
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldAccess;
|
import net.minecraft.world.WorldAccess;
|
||||||
|
@ -23,13 +32,27 @@ import net.minecraft.world.WorldView;
|
||||||
import ru.betterend.blocks.basis.BlockBaseNotFull;
|
import ru.betterend.blocks.basis.BlockBaseNotFull;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
public class BlockSulphuricGeyser extends BlockBaseNotFull implements FluidFillable {
|
public class BlockSulphuricGeyser extends BlockBaseNotFull implements FluidFillable, Waterloggable {
|
||||||
|
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
|
||||||
|
private static final VoxelShape SHAPE = Block.createCuboidShape(1, 1, 1, 15, 16, 15);
|
||||||
|
|
||||||
public BlockSulphuricGeyser() {
|
public BlockSulphuricGeyser() {
|
||||||
super(FabricBlockSettings.of(Material.STONE)
|
super(FabricBlockSettings.of(Material.STONE)
|
||||||
.breakByTool(FabricToolTags.PICKAXES)
|
.breakByTool(FabricToolTags.PICKAXES)
|
||||||
.sounds(BlockSoundGroup.STONE)
|
.sounds(BlockSoundGroup.STONE)
|
||||||
.nonOpaque()
|
.noCollision()
|
||||||
.requiresTool());
|
.requiresTool());
|
||||||
|
this.setDefaultState(getDefaultState().with(WATERLOGGED, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||||
|
builder.add(WATERLOGGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
|
||||||
|
return SHAPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,6 +81,18 @@ public class BlockSulphuricGeyser extends BlockBaseNotFull implements FluidFilla
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||||
|
WorldAccess worldAccess = ctx.getWorld();
|
||||||
|
BlockPos blockPos = ctx.getBlockPos();
|
||||||
|
return this.getDefaultState().with(WATERLOGGED, worldAccess.getFluidState(blockPos).getFluid() == Fluids.WATER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidState getFluidState(BlockState state) {
|
||||||
|
return (Boolean) state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);
|
||||||
|
}
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||||
super.randomDisplayTick(state, world, pos, random);
|
super.randomDisplayTick(state, world, pos, random);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue