Purple Polypore
This commit is contained in:
parent
cd44fbebf8
commit
3e1dad0694
20 changed files with 580 additions and 2 deletions
|
@ -24,6 +24,7 @@ public class BiomeChorusForest extends EndBiome {
|
|||
.addFeature(EndFeatures.END_LAKE_RARE)
|
||||
.addFeature(EndFeatures.PYTHADENDRON_TREE)
|
||||
.addFeature(EndFeatures.PYTHADENDRON_BUSH)
|
||||
.addFeature(EndFeatures.PURPLE_POLYPORE)
|
||||
.addFeature(Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT)
|
||||
.addFeature(Feature.VEGETAL_DECORATION, ConfiguredFeatures.CHORUS_PLANT)
|
||||
.addFeature(EndFeatures.CHORUS_GRASS)
|
||||
|
|
|
@ -25,6 +25,7 @@ public class BiomeShadowForest extends EndBiome {
|
|||
.addFeature(EndFeatures.NEEDLEGRASS)
|
||||
.addFeature(EndFeatures.SHADOW_BERRY)
|
||||
.addFeature(EndFeatures.TWISTED_VINE)
|
||||
.addFeature(EndFeatures.PURPLE_POLYPORE)
|
||||
.addStructureFeature(ConfiguredStructureFeatures.END_CITY)
|
||||
.addMobSpawn(EntityType.ENDERMAN, 80, 1, 4)
|
||||
.addMobSpawn(EntityType.PHANTOM, 1, 1, 2));
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import ru.betterend.blocks.basis.BlockWallPlant;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
public class WallPlantFeature extends WallScatterFeature {
|
||||
private final Block block;
|
||||
|
||||
public WallPlantFeature(Block block, int radius) {
|
||||
super(radius);
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir) {
|
||||
BlockPos blockPos = pos.offset(dir.getOpposite());
|
||||
BlockState blockState = world.getBlockState(blockPos);
|
||||
return ((BlockWallPlant) block).isSupport(world, blockPos, blockState, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir) {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, block.getDefaultState().with(BlockWallPlant.FACING, dir));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
|
||||
public class WallPlantOnLogFeature extends WallPlantFeature {
|
||||
public WallPlantOnLogFeature(Block block, int radius) {
|
||||
super(block, radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir) {
|
||||
BlockPos blockPos = pos.offset(dir.getOpposite());
|
||||
BlockState blockState = world.getBlockState(blockPos);
|
||||
return blockState.isIn(BlockTags.LOGS);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package ru.betterend.world.features;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos.Mutable;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
public abstract class WallScatterFeature extends DefaultFeature {
|
||||
private static final Direction[] DIR = BlocksHelper.makeHorizontal();
|
||||
private final int radius;
|
||||
|
||||
public WallScatterFeature(int radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public abstract boolean canGenerate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir);
|
||||
|
||||
public abstract void generate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir);
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos center, DefaultFeatureConfig featureConfig) {
|
||||
int maxY = world.getTopY(Heightmap.Type.WORLD_SURFACE, center.getX(), center.getZ());
|
||||
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
|
||||
int py = MHelper.randRange(minY, maxY, random);
|
||||
|
||||
Mutable mut = new Mutable();
|
||||
for (int x = -radius; x <= radius; x++) {
|
||||
mut.setX(center.getX() + x);
|
||||
for (int y = -radius; y <= radius; y++) {
|
||||
mut.setY(py + y);
|
||||
for (int z = -radius; z <= radius; z++) {
|
||||
mut.setZ(center.getZ() + z);
|
||||
if (random.nextInt(8) == 0) {
|
||||
shuffle(random);
|
||||
for (Direction dir: DIR) {
|
||||
if (canGenerate(world, random, mut, dir)) {
|
||||
generate(world, random, mut, dir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void shuffle(Random random) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int j = random.nextInt(4);
|
||||
Direction d = DIR[i];
|
||||
DIR[i] = DIR[j];
|
||||
DIR[j] = d;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue