[Fix] Search for Vertical surfaces stays in Chunk (quiqueck/BetterNether#6)
This commit is contained in:
parent
eb2d25ce11
commit
4307c11aab
2 changed files with 19 additions and 3 deletions
|
@ -76,10 +76,13 @@ public class PlaceFacingBlockConfig extends PlaceBlockFeatureConfig {
|
|||
BlockState targetState
|
||||
) {
|
||||
BlockState lookupState;
|
||||
BlockPos testPos;
|
||||
for (Direction dir : directions) {
|
||||
testPos = pos.relative(dir.getOpposite());
|
||||
lookupState = targetState.setValue(HorizontalDirectionalBlock.FACING, dir);
|
||||
if (lookupState.canSurvive(level, pos)) {
|
||||
BlocksHelper.setWithoutUpdate(level, pos, lookupState);
|
||||
if (lookupState.canSurvive(level, testPos) && level.getBlockState(testPos).isAir()) {
|
||||
BlocksHelper.setWithoutUpdate(level, testPos, lookupState);
|
||||
//BlocksHelper.setWithoutUpdate(level, pos, level.getBlockState(pos.relative(dir.getOpposite())));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.mojang.serialization.Codec;
|
|||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.util.ExtraCodecs;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.valueproviders.IntProvider;
|
||||
|
@ -102,12 +103,24 @@ public class FindSolidInDirection extends PlacementModifier {
|
|||
Stream.Builder<BlockPos> builder,
|
||||
Direction d
|
||||
) {
|
||||
int searchDist;
|
||||
BlockPos.MutableBlockPos POS = blockPos.mutable();
|
||||
if (d == Direction.EAST) { //+x
|
||||
searchDist = Math.min(maxSearchDistance, 15 - SectionPos.sectionRelative(blockPos.getX()));
|
||||
} else if (d == Direction.WEST) { //-x
|
||||
searchDist = Math.min(maxSearchDistance, SectionPos.sectionRelative(blockPos.getX()));
|
||||
} else if (d == Direction.SOUTH) { //+z
|
||||
searchDist = Math.min(maxSearchDistance, 15 - SectionPos.sectionRelative(blockPos.getZ()));
|
||||
} else if (d == Direction.NORTH) { //-z
|
||||
searchDist = Math.min(maxSearchDistance, SectionPos.sectionRelative(blockPos.getZ()));
|
||||
} else {
|
||||
searchDist = maxSearchDistance;
|
||||
}
|
||||
if (BlocksHelper.findOnSurroundingSurface(
|
||||
placementContext.getLevel(),
|
||||
POS,
|
||||
d,
|
||||
maxSearchDistance,
|
||||
searchDist,
|
||||
BlocksHelper::isTerrain
|
||||
)) {
|
||||
builder.add(POS);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue