Continue mapping migration
This commit is contained in:
parent
99ade39404
commit
f03fd03bd0
499 changed files with 12567 additions and 12723 deletions
|
@ -1,11 +1,10 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.VineBlock;
|
||||
|
@ -15,7 +14,7 @@ public class VineFeature extends InvertedScatterFeature {
|
|||
private final Block vineBlock;
|
||||
private final int maxLength;
|
||||
private final boolean vine;
|
||||
|
||||
|
||||
public VineFeature(Block vineBlock, int maxLength) {
|
||||
super(6);
|
||||
this.vineBlock = vineBlock;
|
||||
|
@ -30,7 +29,7 @@ public class VineFeature extends InvertedScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void place(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
public void generate(WorldGenLevel world, Random random, BlockPos blockPos) {
|
||||
int h = BlocksHelper.downRay(world, blockPos, random.nextInt(maxLength)) - 1;
|
||||
if (h > 2) {
|
||||
BlockState top = getTopState();
|
||||
|
@ -38,32 +37,33 @@ public class VineFeature extends InvertedScatterFeature {
|
|||
BlockState bottom = getBottomState();
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos, top);
|
||||
for (int i = 1; i < h; i++) {
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos.down(i), middle);
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos.below(i), middle);
|
||||
}
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos.down(h), bottom);
|
||||
BlocksHelper.setWithoutUpdate(world, blockPos.below(h), bottom);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean canPlaceBlock(BlockState state, WorldGenLevel world, BlockPos blockPos) {
|
||||
if (vine) {
|
||||
return ((VineBlock) vineBlock).canGenerate(state, world, blockPos);
|
||||
} else {
|
||||
return vineBlock.canPlaceAt(state, world, blockPos);
|
||||
}
|
||||
else {
|
||||
return vineBlock.canSurvive(state, world, blockPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private BlockState getTopState() {
|
||||
BlockState state = vineBlock.defaultBlockState();
|
||||
return vine ? state.with(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP) : state;
|
||||
return vine ? state.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP) : state;
|
||||
}
|
||||
|
||||
|
||||
private BlockState getMiggleState() {
|
||||
BlockState state = vineBlock.defaultBlockState();
|
||||
return vine ? state.with(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE) : state;
|
||||
return vine ? state.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE) : state;
|
||||
}
|
||||
|
||||
|
||||
private BlockState getBottomState() {
|
||||
BlockState state = vineBlock.defaultBlockState();
|
||||
return vine ? state.with(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM) : state;
|
||||
return vine ? state.setValue(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM) : state;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue