Start migration
This commit is contained in:
parent
6630ce0cab
commit
47ed597358
491 changed files with 12045 additions and 11953 deletions
|
@ -5,29 +5,29 @@ 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.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FluidDrainable;
|
||||
import net.minecraft.block.FluidFillable;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.BlockRenderType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.FluidDrainable;
|
||||
import net.minecraft.world.level.block.FluidFillable;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.block.ShapeContext;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -38,11 +38,11 @@ public class VentBubbleColumnBlock extends Block implements FluidDrainable, Flui
|
|||
}
|
||||
|
||||
@Override
|
||||
public Fluid tryDrainFluid(WorldAccess world, BlockPos pos, BlockState state) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 11);
|
||||
public Fluid tryDrainFluid(LevelAccessor world, BlockPos pos, BlockState state) {
|
||||
world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState(), 11);
|
||||
return Fluids.WATER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.INVISIBLE;
|
||||
|
@ -50,8 +50,8 @@ public class VentBubbleColumnBlock extends Block implements FluidDrainable, Flui
|
|||
|
||||
@Override
|
||||
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
|
||||
BlockState blockState = world.getBlockState(pos.down());
|
||||
return blockState.isOf(this) || blockState.isOf(EndBlocks.HYDROTHERMAL_VENT);
|
||||
BlockState blockState = world.getBlockState(pos.below());
|
||||
return blockState.is(this) || blockState.is(EndBlocks.HYDROTHERMAL_VENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,13 +60,13 @@ public class VentBubbleColumnBlock extends Block implements FluidDrainable, Flui
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
|
||||
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world,
|
||||
BlockPos pos, BlockPos posFrom) {
|
||||
if (!state.canPlaceAt(world, pos)) {
|
||||
return Blocks.WATER.getDefaultState();
|
||||
}
|
||||
else {
|
||||
return Blocks.WATER.defaultBlockState();
|
||||
} else {
|
||||
BlockPos up = pos.up();
|
||||
if (world.getBlockState(up).isOf(Blocks.WATER)) {
|
||||
if (world.getBlockState(up).is(Blocks.WATER)) {
|
||||
BlocksHelper.setWithoutUpdate(world, up, this);
|
||||
world.getBlockTickScheduler().schedule(up, this, 5);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class VentBubbleColumnBlock extends Block implements FluidDrainable, Flui
|
|||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||
public void animateTick(BlockState state, Level world, BlockPos pos, Random random) {
|
||||
if (random.nextInt(4) == 0) {
|
||||
double px = pos.getX() + random.nextDouble();
|
||||
double py = pos.getY() + random.nextDouble();
|
||||
|
@ -83,39 +83,43 @@ public class VentBubbleColumnBlock extends Block implements FluidDrainable, Flui
|
|||
world.addImportantParticle(ParticleTypes.BUBBLE_COLUMN_UP, px, py, pz, 0, 0.04, 0);
|
||||
}
|
||||
if (random.nextInt(200) == 0) {
|
||||
world.playSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT, SoundCategory.BLOCKS, 0.2F + random.nextFloat() * 0.2F, 0.9F + random.nextFloat() * 0.15F, false);
|
||||
world.playLocalSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT,
|
||||
SoundSource.BLOCKS, 0.2F + random.nextFloat() * 0.2F, 0.9F + random.nextFloat() * 0.15F, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
|
||||
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
||||
BlockState blockState = world.getBlockState(pos.up());
|
||||
if (blockState.isAir()) {
|
||||
entity.onBubbleColumnSurfaceCollision(false);
|
||||
if (!world.isClient) {
|
||||
ServerWorld serverWorld = (ServerWorld) world;
|
||||
if (!world.isClientSide) {
|
||||
ServerLevel serverWorld = (ServerLevel) world;
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
serverWorld.spawnParticles(ParticleTypes.SPLASH, (double) pos.getX() + world.random.nextDouble(), (double) (pos.getY() + 1), (double) pos.getZ() + world.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D);
|
||||
serverWorld.spawnParticles(ParticleTypes.BUBBLE, (double) pos.getX() + world.random.nextDouble(), (double) (pos.getY() + 1), (double) pos.getZ() + world.random.nextDouble(), 1, 0.0D, 0.01D, 0.0D, 0.2D);
|
||||
serverWorld.sendParticles(ParticleTypes.SPLASH, (double) pos.getX() + world.random.nextDouble(),
|
||||
(double) (pos.getY() + 1), (double) pos.getZ() + world.random.nextDouble(), 1, 0.0D, 0.0D,
|
||||
0.0D, 1.0D);
|
||||
serverWorld.sendParticles(ParticleTypes.BUBBLE, (double) pos.getX() + world.random.nextDouble(),
|
||||
(double) (pos.getY() + 1), (double) pos.getZ() + world.random.nextDouble(), 1, 0.0D, 0.01D,
|
||||
0.0D, 0.2D);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
entity.onBubbleColumnCollision(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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) {
|
||||
public boolean tryFillWithFluid(LevelAccessor world, BlockPos pos, BlockState state, FluidState fluidState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return Fluids.WATER.getStill(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue