Fixed 'place'-Methods
This commit is contained in:
parent
4bf09362be
commit
a82f30b95d
17 changed files with 103 additions and 52 deletions
|
@ -13,6 +13,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
@ -36,11 +37,13 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
private static final List<Vector3f> SIDE;
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
if (!world.getBlockState(pos.below(4)).getBlock().is(TagAPI.GEN_TERRAIN))
|
||||
if (!world.getBlockState(pos.below(4)).is(TagAPI.GEN_TERRAIN))
|
||||
return false;
|
||||
|
||||
BlockState stem = Integrations.BYG.getDefaultState("bulbis_stem");
|
||||
|
|
|
@ -2,6 +2,8 @@ package ru.betterend.mixin.common;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
@ -34,7 +36,7 @@ import ru.betterend.world.generator.GeneratorOptions;
|
|||
@Mixin(SpikeFeature.class)
|
||||
public class SpikeFeatureMixin {
|
||||
@Inject(method = "place", at = @At("HEAD"), cancellable = true)
|
||||
private void be_place(WorldGenLevel structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, SpikeConfiguration endSpikeFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
private void be_place(FeaturePlaceContext<SpikeConfiguration> featurePlaceContext, CallbackInfoReturnable<Boolean> info) {
|
||||
if (!GeneratorOptions.hasPillars()) {
|
||||
info.setReturnValue(false);
|
||||
}
|
||||
|
@ -70,7 +72,7 @@ public class SpikeFeatureMixin {
|
|||
radius--;
|
||||
StructureTemplate base = StructureHelper.readStructure(BetterEnd.makeID("pillars/pillar_base_" + radius));
|
||||
StructureTemplate top = StructureHelper.readStructure(BetterEnd.makeID("pillars/pillar_top_" + radius + (spike.isGuarded() ? "_cage" : "")));
|
||||
BlockPos side = base.getSize();
|
||||
Vec3i side = base.getSize();
|
||||
BlockPos pos1 = new BlockPos(x - (side.getX() >> 1), minY - 3, z - (side.getZ() >> 1));
|
||||
minY = pos1.getY() + side.getY();
|
||||
side = top.getSize();
|
||||
|
@ -78,8 +80,8 @@ public class SpikeFeatureMixin {
|
|||
maxY = pos2.getY();
|
||||
|
||||
StructurePlaceSettings data = new StructurePlaceSettings();
|
||||
base.placeInWorldChunk(world, pos1, data, random);
|
||||
top.placeInWorldChunk(world, pos2, data, random);
|
||||
base.placeInWorld(world, pos1, pos1, data, random, 2);
|
||||
top.placeInWorld(world, pos2, pos2, data, random, 2);
|
||||
|
||||
int r2 = radius * radius + 1;
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.world.level.biome.Biome;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
|
||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderConfiguration;
|
||||
|
@ -29,8 +30,9 @@ public class BiomeIslandFeature extends DefaultFeature {
|
|||
private static BlockState underBlock = Blocks.DIRT.defaultBlockState();
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
Biome biome = world.getBiome(pos);
|
||||
SurfaceBuilderConfiguration surfaceConfig = biome.getGenerationSettings().getSurfaceBuilderConfig();
|
||||
BlockState topMaterial = surfaceConfig.getTopMaterial();
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Random;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
@ -14,8 +15,10 @@ import ru.betterend.registry.EndBlocks;
|
|||
|
||||
public class CavePumpkinFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.above()).is(TagAPI.GEN_TERRAIN) || !world.isEmptyBlock(pos)
|
||||
|| !world.isEmptyBlock(pos.below())) {
|
||||
return false;
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.world.level.block.Mirror;
|
|||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockIgnoreProcessor;
|
||||
|
@ -75,8 +76,10 @@ public class CrashedShipFeature extends NBTStructureFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
center = new BlockPos(((center.getX() >> 4) << 4) | 8, 128, ((center.getZ() >> 4) << 4) | 8);
|
||||
center = getGround(world, center);
|
||||
BoundingBox bounds = makeBox(center);
|
||||
|
@ -88,7 +91,7 @@ public class CrashedShipFeature extends NBTStructureFeature {
|
|||
StructureTemplate structure = getStructure(world, center, random);
|
||||
Rotation rotation = getRotation(world, center, random);
|
||||
Mirror mirror = getMirror(world, center, random);
|
||||
BlockPos offset = StructureTemplate.transform(structure.getSize(), mirror, rotation, BlockPos.ZERO);
|
||||
BlockPos offset = StructureTemplate.transform(new BlockPos(structure.getSize()), mirror, rotation, BlockPos.ZERO);
|
||||
center = center.offset(0, getYOffset(structure, world, center, random) + 0.5, 0);
|
||||
StructurePlaceSettings placementData = new StructurePlaceSettings().setRotation(rotation).setMirror(mirror);
|
||||
center = center.offset(-offset.getX() * 0.5, 0, -offset.getZ() * 0.5);
|
||||
|
@ -97,10 +100,10 @@ public class CrashedShipFeature extends NBTStructureFeature {
|
|||
bounds = StructureHelper.intersectBoxes(bounds, structB);
|
||||
|
||||
addStructureData(placementData);
|
||||
structure.placeInWorldChunk(world, center, placementData.setBoundingBox(bounds), random);
|
||||
structure.placeInWorld(world, center, center, placementData.setBoundingBox(bounds), random, 2);
|
||||
|
||||
StructureHelper.erodeIntense(world, bounds, random);
|
||||
BlockFixer.fixBlocks(world, new BlockPos(bounds.x0, bounds.y0, bounds.z0), new BlockPos(bounds.x1, bounds.y1, bounds.z1));
|
||||
BlockFixer.fixBlocks(world, new BlockPos(bounds.minX(), bounds.minY(), bounds.minZ()), new BlockPos(bounds.maxX(), bounds.maxY(), bounds.maxZ()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.core.BlockPos.MutableBlockPos;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -26,8 +27,10 @@ public abstract class FullHeightScatterFeature extends DefaultFeature {
|
|||
public abstract void generate(WorldGenLevel world, Random random, BlockPos blockPos);
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
int maxY = world.getHeight(Heightmap.Types.WORLD_SURFACE_WG, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
for (int y = maxY; y > minY; y--) {
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.core.BlockPos.MutableBlockPos;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -26,8 +27,10 @@ public abstract class InvertedScatterFeature extends DefaultFeature {
|
|||
public abstract void generate(WorldGenLevel world, Random random, BlockPos blockPos);
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
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);
|
||||
for (int y = maxY; y > minY; y--) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.blocks.NeonCactusPlantBlock;
|
||||
|
@ -13,7 +14,10 @@ import ru.betterend.registry.EndBlocks;
|
|||
|
||||
public class NeonCactusFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, NoneFeatureConfiguration config) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
BlockState ground = world.getBlockState(pos.below());
|
||||
if (!ground.is(EndBlocks.ENDSTONE_DUST) && !ground.is(EndBlocks.END_MOSS)) {
|
||||
return false;
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
@ -56,8 +57,10 @@ public abstract class ScatterFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
center = getCenterGround(world, center);
|
||||
|
||||
if (!canSpawn(world, center)) {
|
||||
|
|
|
@ -11,6 +11,7 @@ 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.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.blocks.BlockProperties;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
@ -34,8 +35,10 @@ public class SilkMothNestFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
|
||||
NoneFeatureConfiguration featureConfig) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
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);
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
@ -26,7 +27,10 @@ public abstract class WallScatterFeature extends DefaultFeature {
|
|||
public abstract void generate(WorldGenLevel world, Random random, BlockPos pos, Direction dir);
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center, NoneFeatureConfiguration featureConfig) {
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos center = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
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);
|
||||
if (maxY < 10 || maxY < minY) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -35,10 +36,12 @@ public class BushFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)
|
||||
&& !world.getBlockState(pos.above()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)
|
||||
&& !world.getBlockState(pos.above()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
float radius = MHelper.randRange(1.8F, 3.5F, random);
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.world.level.block.LeavesBlock;
|
|||
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.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -39,10 +40,12 @@ public class BushWithOuterFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND)
|
||||
&& !world.getBlockState(pos.above()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)
|
||||
&& !world.getBlockState(pos.above()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
float radius = MHelper.randRange(1.8F, 3.5F, random);
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.blocks.BlockProperties;
|
||||
|
@ -19,9 +20,11 @@ import ru.betterend.registry.EndBlocks;
|
|||
|
||||
public class LargeAmaranitaFeature extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
MutableBlockPos mut = new MutableBlockPos().set(pos);
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
@ -19,9 +20,11 @@ import ru.betterend.registry.EndBlocks;
|
|||
|
||||
public class Lumecorn extends DefaultFeature {
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
int height = MHelper.randRange(4, 7, random);
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.world.level.WorldGenLevel;
|
|||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import ru.bclib.api.TagAPI;
|
||||
|
@ -39,9 +40,11 @@ public class TenaneaBushFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(TagAPI.END_GROUND))
|
||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||
Random random = featureConfig.random();
|
||||
BlockPos pos = featureConfig.origin();
|
||||
WorldGenLevel world = featureConfig.level();
|
||||
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
|
||||
return false;
|
||||
|
||||
float radius = MHelper.randRange(1.8F, 3.5F, random);
|
||||
|
|
|
@ -3,6 +3,7 @@ package ru.betterend.world.structures.piece;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -70,16 +71,18 @@ public class NBTPiece extends BasePiece {
|
|||
|
||||
@Override
|
||||
public boolean postProcess(WorldGenLevel world, StructureFeatureManager arg, ChunkGenerator chunkGenerator, Random random, BoundingBox blockBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||
BoundingBox bounds = new BoundingBox(blockBox);
|
||||
bounds.y1 = this.boundingBox.y1;
|
||||
bounds.y0 = this.boundingBox.y0;
|
||||
BoundingBox bounds = BoundingBox.fromCorners(
|
||||
new Vec3i(blockBox.minX(), this.boundingBox.minY(), blockBox.minZ()),
|
||||
new Vec3i(blockBox.maxX(), this.boundingBox.maxX(), blockBox.maxZ())
|
||||
);
|
||||
StructurePlaceSettings placementData = new StructurePlaceSettings().setRotation(rotation).setMirror(mirror).setBoundingBox(bounds);
|
||||
structure.placeInWorldChunk(world, pos, placementData, random);
|
||||
structure.placeInWorld(world, pos, pos, placementData, random, 2);
|
||||
if (erosion > 0) {
|
||||
bounds.x1 = MHelper.min(bounds.x1, boundingBox.x1);
|
||||
bounds.x0 = MHelper.max(bounds.x0, boundingBox.x0);
|
||||
bounds.z1 = MHelper.min(bounds.z1, boundingBox.z1);
|
||||
bounds.z0 = MHelper.max(bounds.z0, boundingBox.z0);
|
||||
int x1 = MHelper.min(bounds.maxX(), boundingBox.maxX());
|
||||
int x0 = MHelper.max(bounds.minX(), boundingBox.minX());
|
||||
int z1 = MHelper.min(bounds.maxZ(), boundingBox.maxZ());
|
||||
int z0 = MHelper.max(bounds.minZ(), boundingBox.minZ());
|
||||
bounds = BoundingBox.fromCorners(new Vec3i(x0, bounds.minY(), z0), new Vec3i(x1, bounds.maxY(), z1));
|
||||
StructureHelper.erode(world, bounds, erosion, random);
|
||||
}
|
||||
if (cover) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue