Continue mapping migration

This commit is contained in:
Aleksey 2021-04-12 21:38:22 +03:00
parent 99ade39404
commit f03fd03bd0
499 changed files with 12567 additions and 12723 deletions

View file

@ -1,73 +1,69 @@
package ru.betterend.blocks;
import java.util.Random;
import net.minecraft.world.level.block.AbstractBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.ShapeContext;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.WorldView;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
import ru.betterend.registry.EndBlocks;
public class CavePumpkinVineBlock extends EndPlantWithAgeBlock {
private static final VoxelShape SHAPE = Block.createCuboidShape(4, 0, 4, 12, 16, 12);
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 16, 12);
@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
BlockState down = world.getBlockState(pos.up());
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
BlockState down = world.getBlockState(pos.above());
return isTerrain(down);
}
@Override
public void grow(ServerLevel world, Random random, BlockPos pos, BlockState state) {
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
int age = state.getValue(AGE);
BlockState down = world.getBlockState(pos.below());
if (down.getMaterial().isReplaceable()
|| (down.is(EndBlocks.CAVE_PUMPKIN) && down.get(BlockProperties.SMALL))) {
if (down.getMaterial().isReplaceable() || (down.is(EndBlocks.CAVE_PUMPKIN) && down.getValue(BlockProperties.SMALL))) {
if (age < 3) {
world.setBlockAndUpdate(pos, state.with(AGE, age + 1));
world.setBlockAndUpdate(pos, state.setValue(AGE, age + 1));
}
if (age == 2) {
world.setBlockAndUpdate(pos.below(),
EndBlocks.CAVE_PUMPKIN.defaultBlockState().with(BlockProperties.SMALL, true));
} else if (age == 3) {
world.setBlockAndUpdate(pos.below(), EndBlocks.CAVE_PUMPKIN.defaultBlockState().setValue(BlockProperties.SMALL, true));
}
else if (age == 3) {
world.setBlockAndUpdate(pos.below(), EndBlocks.CAVE_PUMPKIN.defaultBlockState());
}
}
}
@Override
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
}
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {}
@Override
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world,
BlockPos pos, BlockPos neighborPos) {
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
state = super.updateShape(state, facing, neighborState, world, pos, neighborPos);
if (state.is(this) && state.getValue(BlockProperties.AGE) > 1) {
BlockState down = world.getBlockState(pos.below());
if (!down.is(EndBlocks.CAVE_PUMPKIN)) {
state = state.with(BlockProperties.AGE, 1);
state = state.setValue(BlockProperties.AGE, 1);
}
}
return state;
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return SHAPE;
}
@Override
public AbstractBlock.OffsetType getOffsetType() {
return AbstractBlock.OffsetType.NONE;
public BlockBehaviour.OffsetType getOffsetType() {
return BlockBehaviour.OffsetType.NONE;
}
}