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

@ -23,6 +23,7 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldView;
import ru.betterend.blocks.basis.BlockAttached;
import ru.betterend.client.render.ERenderLayer;
import ru.betterend.interfaces.IRenderTypeable;
@ -54,6 +55,13 @@ public class BlockSmallJellyshroom extends BlockAttached implements IRenderTypea
}
}
@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
Direction direction = (Direction) state.get(FACING);
BlockPos blockPos = pos.offset(direction.getOpposite());
return sideCoversSmallSquare(world, blockPos, direction) && world.getBlockState(blockPos).isOpaque();
}
@Override
public ERenderLayer getRenderLayer() {
return ERenderLayer.CUTOUT;

View file

@ -17,11 +17,12 @@ import net.minecraft.world.WorldView;
import ru.betterend.util.BlocksHelper;
public abstract class BlockAttached extends BlockBaseNotFull {
public static final DirectionProperty FACING = Properties.FACING;
public BlockAttached(Settings settings) {
super(settings);
this.setDefaultState(this.getDefaultState().with(FACING, Direction.UP));
}
public static final DirectionProperty FACING = Properties.FACING;
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {