Continue mapping migration
This commit is contained in:
parent
99ade39404
commit
f03fd03bd0
499 changed files with 12567 additions and 12723 deletions
|
@ -1,16 +1,15 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -20,12 +19,12 @@ public class SilkMothNestFeature extends DefaultFeature {
|
|||
private static final MutableBlockPos POS = new MutableBlockPos();
|
||||
|
||||
private boolean canGenerate(WorldGenLevel world, BlockPos pos) {
|
||||
BlockState state = world.getBlockState(pos.up());
|
||||
if (state.isIn(BlockTags.LEAVES) || state.isIn(BlockTags.LOGS)) {
|
||||
BlockState state = world.getBlockState(pos.above());
|
||||
if (state.is(BlockTags.LEAVES) || state.is(BlockTags.LOGS)) {
|
||||
state = world.getBlockState(pos);
|
||||
if ((state.isAir() || state.is(EndBlocks.TENANEA_OUTER_LEAVES)) && world.isAir(pos.below())) {
|
||||
if ((state.isAir() || state.is(EndBlocks.TENANEA_OUTER_LEAVES)) && world.isEmptyBlock(pos.below())) {
|
||||
for (Direction dir : BlocksHelper.HORIZONTAL) {
|
||||
if (world.getBlockState(pos.below().offset(dir)).getMaterial().blocksMovement()) {
|
||||
if (world.getBlockState(pos.below().relative(dir)).getMaterial().blocksMotion()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -38,7 +37,7 @@ public class SilkMothNestFeature extends DefaultFeature {
|
|||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
int maxY = world.getTopY(Heightmap.Type.WORLD_SURFACE, center.getX(), center.getZ());
|
||||
int maxY = world.getHeight(Heightmap.Types.WORLD_SURFACE, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
POS.set(center);
|
||||
for (int y = maxY; y > minY; y--) {
|
||||
|
@ -46,10 +45,10 @@ public class SilkMothNestFeature extends DefaultFeature {
|
|||
if (canGenerate(world, POS)) {
|
||||
Direction dir = BlocksHelper.randomHorizontal(random);
|
||||
BlocksHelper.setWithoutUpdate(world, POS, EndBlocks.SILK_MOTH_NEST.defaultBlockState()
|
||||
.with(Properties.HORIZONTAL_FACING, dir).with(BlockProperties.ACTIVE, false));
|
||||
.setValue(BlockStateProperties.HORIZONTAL_FACING, dir).setValue(BlockProperties.ACTIVE, false));
|
||||
POS.setY(y - 1);
|
||||
BlocksHelper.setWithoutUpdate(world, POS,
|
||||
EndBlocks.SILK_MOTH_NEST.defaultBlockState().with(Properties.HORIZONTAL_FACING, dir));
|
||||
BlocksHelper.setWithoutUpdate(world, POS, EndBlocks.SILK_MOTH_NEST.defaultBlockState()
|
||||
.setValue(BlockStateProperties.HORIZONTAL_FACING, dir));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue