Moss improvements
This commit is contained in:
parent
72b173a9e3
commit
239bb80bd7
10 changed files with 841 additions and 6 deletions
49
src/main/java/ru/betterend/blocks/BlockUmbrellaMoss.java
Normal file
49
src/main/java/ru/betterend/blocks/BlockUmbrellaMoss.java
Normal file
|
@ -0,0 +1,49 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import ru.betterend.blocks.basis.BlockDoublePlant;
|
||||
import ru.betterend.blocks.basis.BlockPlant;
|
||||
import ru.betterend.registry.BlockRegistry;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
public class BlockUmbrellaMoss extends BlockPlant {
|
||||
public BlockUmbrellaMoss() {
|
||||
super(11);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.getBlock() == BlockRegistry.END_MOSS || state.getBlock() == BlockRegistry.END_MYCELIUM;
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public boolean hasEmissiveLighting(BlockView world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public float getAmbientOcclusionLightLevel(BlockView world, BlockPos pos) {
|
||||
return 1F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) {
|
||||
return world.isAir(pos.up());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
|
||||
int rot = world.random.nextInt(4);
|
||||
BlockState bs = BlockRegistry.UMBRELLA_MOSS_TALL.getDefaultState().with(BlockDoublePlant.ROTATION, rot);
|
||||
BlocksHelper.setWithoutUpdate(world, pos, bs);
|
||||
BlocksHelper.setWithoutUpdate(world, pos.up(), bs.with(BlockDoublePlant.TOP, true));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue