Mushrooms generation

This commit is contained in:
paulevsGitch 2020-12-25 11:50:45 +03:00
parent 989dbdb583
commit ae3756d9ee
7 changed files with 80 additions and 6 deletions

View file

@ -14,9 +14,13 @@ public class BiomeUmbrellaJungle extends EndBiome {
.addFeature(EndFeatures.END_LAKE)
.addFeature(EndFeatures.UMBRELLA_TREE)
.addFeature(EndFeatures.TWISTED_UMBRELLA_MOSS)
.addFeature(EndFeatures.SMALL_JELLYSHROOM_FLOOR)
.addFeature(EndFeatures.JUNGLE_GRASS)
.addFeature(EndFeatures.CYAN_MOSS)
.addFeature(EndFeatures.CYAN_MOSS_WOOD)
.addFeature(EndFeatures.SMALL_JELLYSHROOM_WALL)
.addFeature(EndFeatures.SMALL_JELLYSHROOM_WOOD)
.addFeature(EndFeatures.SMALL_JELLYSHROOM_CEIL)
.addFeature(EndFeatures.CHARNIA_CYAN)
.addFeature(EndFeatures.CHARNIA_GREEN)
.addFeature(EndFeatures.CHARNIA_LIGHT_BLUE)

View file

@ -0,0 +1,39 @@
package ru.betterend.world.features;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.basis.BlockAttached;
import ru.betterend.util.BlocksHelper;
public class SingleInvertedScatterFeature extends InvertedScatterFeature {
private final Block block;
public SingleInvertedScatterFeature(Block block, int radius) {
super(radius);
this.block = block;
}
@Override
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos, float radius) {
BlockState state = block.getDefaultState();
if (block instanceof BlockAttached) {
state = state.with(Properties.FACING, Direction.DOWN);
}
return state.canPlaceAt(world, blockPos);
}
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos blockPos) {
BlockState state = block.getDefaultState();
if (block instanceof BlockAttached) {
state = state.with(Properties.FACING, Direction.DOWN);
}
BlocksHelper.setWithoutUpdate(world, blockPos, state);
}
}

View file

@ -4,9 +4,11 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.basis.BlockAttached;
import ru.betterend.blocks.basis.BlockWallPlant;
import ru.betterend.util.BlocksHelper;
@ -20,13 +22,26 @@ public class WallPlantFeature extends WallScatterFeature {
@Override
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir) {
BlockState state = block.getDefaultState().with(BlockWallPlant.FACING, dir);
return block.canPlaceAt(state, world, pos);
if (block instanceof BlockWallPlant) {
BlockState state = block.getDefaultState().with(BlockWallPlant.FACING, dir);
return block.canPlaceAt(state, world, pos);
}
else if (block instanceof BlockAttached) {
BlockState state = block.getDefaultState().with(Properties.FACING, dir);
return block.canPlaceAt(state, world, pos);
}
return block.canPlaceAt(block.getDefaultState(), world, pos);
}
@Override
public void generate(StructureWorldAccess world, Random random, BlockPos pos, Direction dir) {
BlockState state = block.getDefaultState().with(BlockWallPlant.FACING, dir);
BlockState state = block.getDefaultState();
if (block instanceof BlockWallPlant) {
state = state.with(BlockWallPlant.FACING, dir);
}
else if (block instanceof BlockAttached) {
state = state.with(Properties.FACING, dir);
}
BlocksHelper.setWithoutUpdate(world, pos, state);
}
}

View file

@ -10,8 +10,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;