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,12 +1,11 @@
package ru.betterend.blocks;
import java.util.Random;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.tags.BlockTags;
import net.minecraft.core.BlockPos;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.WorldView;
import net.minecraft.world.level.block.state.BlockState;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
import ru.betterend.registry.EndBlocks;
@ -15,23 +14,20 @@ import ru.betterend.util.BlocksHelper;
public class BulbVineSeedBlock extends EndPlantWithAgeBlock {
@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
BlockState up = world.getBlockState(pos.up());
return up.isIn(EndTags.GEN_TERRAIN) || up.isIn(BlockTags.LOGS) || up.isIn(BlockTags.LEAVES);
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
BlockState up = world.getBlockState(pos.above());
return up.is(EndTags.GEN_TERRAIN) || up.is(BlockTags.LOGS) || up.is(BlockTags.LEAVES);
}
@Override
public void growAdult(WorldGenLevel world, Random random, BlockPos pos) {
int h = BlocksHelper.downRay(world, pos, random.nextInt(24)) - 1;
if (h > 2) {
BlocksHelper.setWithoutUpdate(world, pos,
EndBlocks.BULB_VINE.defaultBlockState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP));
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.BULB_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP));
for (int i = 1; i < h; i++) {
BlocksHelper.setWithoutUpdate(world, pos.down(i),
EndBlocks.BULB_VINE.defaultBlockState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE));
BlocksHelper.setWithoutUpdate(world, pos.below(i), EndBlocks.BULB_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE));
}
BlocksHelper.setWithoutUpdate(world, pos.down(h),
EndBlocks.BULB_VINE.defaultBlockState().with(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM));
BlocksHelper.setWithoutUpdate(world, pos.below(h), EndBlocks.BULB_VINE.defaultBlockState().setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM));
}
}
}