Start migration

This commit is contained in:
Aleksey 2021-04-08 21:55:07 +03:00
parent 6630ce0cab
commit 47ed597358
491 changed files with 12045 additions and 11953 deletions

View file

@ -5,20 +5,20 @@ 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.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.entity.ItemEntity;
import net.minecraft.world.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.particle.ParticleTypes;
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.world.item.ItemStack;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.sounds.SoundSource;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.GameRules;
import net.minecraft.world.World;
import net.minecraft.world.level.Level;
import ru.betterend.blocks.basis.BlockBaseNotFull;
import ru.betterend.client.render.ERenderLayer;
import ru.betterend.interfaces.IRenderTypeable;
@ -31,20 +31,21 @@ public class MengerSpongeWetBlock extends BlockBaseNotFull implements IRenderTyp
}
@Override
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) {
public void onBlockAdded(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
if (world.getDimension().isUltrawarm()) {
world.setBlockState(pos, EndBlocks.MENGER_SPONGE.getDefaultState(), 3);
world.setBlockAndUpdate(pos, EndBlocks.MENGER_SPONGE.defaultBlockState(), 3);
world.syncWorldEvent(2009, pos, 0);
world.playSound((PlayerEntity) null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, (1.0F + world.getRandom().nextFloat() * 0.2F) * 0.7F);
world.playLocalSound((PlayerEntity) null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundSource.BLOCKS, 1.0F,
(1.0F + world.getRandom().nextFloat() * 0.2F) * 0.7F);
}
}
@Override
@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) {
Direction direction = Direction.random(random);
if (direction != Direction.UP) {
BlockPos blockPos = pos.offset(direction);
BlockPos blockPos = pos.relative(direction);
BlockState blockState = world.getBlockState(blockPos);
if (!state.isOpaque() || !blockState.isSideSolidFullSquare(world, blockPos, direction.getOpposite())) {
double x = (double) pos.getX();
@ -54,24 +55,20 @@ public class MengerSpongeWetBlock extends BlockBaseNotFull implements IRenderTyp
y -= 0.05;
x += random.nextDouble();
z += random.nextDouble();
}
else {
} else {
y += random.nextDouble() * 0.8;
if (direction.getAxis() == Direction.Axis.X) {
z += random.nextDouble();
if (direction == Direction.EAST) {
++x;
}
else {
} else {
x += 0.05;
}
}
else {
} else {
x += random.nextDouble();
if (direction == Direction.SOUTH) {
++z;
}
else {
} else {
z += 0.05;
}
}
@ -83,22 +80,23 @@ public class MengerSpongeWetBlock extends BlockBaseNotFull implements IRenderTyp
}
@Override
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
public void onBreak(Level world, BlockPos pos, BlockState state, PlayerEntity player) {
BlocksHelper.setWithUpdate(world, pos, Blocks.AIR);
if (!world.isClient()) {
if (!world.isClientSide()) {
world.syncWorldEvent(2001, pos, getRawIdFromState(state));
}
if (world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS) && (player == null || !player.isCreative())) {
ItemEntity drop = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, new ItemStack(this));
ItemEntity drop = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
new ItemStack(this));
world.spawnEntity(drop);
}
}
@Override
public ERenderLayer getRenderLayer() {
return ERenderLayer.CUTOUT;
}
@Override
public FluidState getFluidState(BlockState state) {
return Fluids.WATER.getStill(false);