End lotus stem and flower
This commit is contained in:
parent
da5fba92c2
commit
fcf084ab13
11 changed files with 287 additions and 0 deletions
42
src/main/java/ru/betterend/blocks/BlockEndLotusFlower.java
Normal file
42
src/main/java/ru/betterend/blocks/BlockEndLotusFlower.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.BlockView;
|
||||
import ru.betterend.blocks.basis.BlockPlant;
|
||||
import ru.betterend.registry.BlockTagRegistry;
|
||||
|
||||
public class BlockEndLotusFlower extends BlockPlant {
|
||||
private static final VoxelShape SHAPE_OUTLINE = Block.createCuboidShape(2, 0, 2, 14, 14, 14);
|
||||
private static final VoxelShape SHAPE_COLLISION = Block.createCuboidShape(0, 0, 0, 16, 2, 16);
|
||||
|
||||
public BlockEndLotusFlower() {
|
||||
super(FabricBlockSettings.of(Material.PLANT).lightLevel(15));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.isIn(BlockTagRegistry.END_GROUND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractBlock.OffsetType getOffsetType() {
|
||||
return AbstractBlock.OffsetType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
|
||||
return SHAPE_OUTLINE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
|
||||
return SHAPE_COLLISION;
|
||||
}
|
||||
}
|
51
src/main/java/ru/betterend/blocks/BlockEndLotusStem.java
Normal file
51
src/main/java/ru/betterend/blocks/BlockEndLotusStem.java
Normal file
|
@ -0,0 +1,51 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.Waterloggable;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import ru.betterend.blocks.basis.BlockBase;
|
||||
|
||||
public class BlockEndLotusStem extends BlockBase implements Waterloggable {
|
||||
private static final VoxelShape SHAPE = Block.createCuboidShape(5, 0, 5, 11, 16, 11);
|
||||
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
|
||||
|
||||
public BlockEndLotusStem() {
|
||||
super(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS));
|
||||
this.setDefaultState(getDefaultState().with(WATERLOGGED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||
builder.add(WATERLOGGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return (Boolean) state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);
|
||||
}
|
||||
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
|
||||
if ((Boolean) state.get(WATERLOGGED)) {
|
||||
world.getFluidTickScheduler().schedule(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||
}
|
||||
return state;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,8 @@ import ru.betterend.blocks.BlockBubbleCoral;
|
|||
import ru.betterend.blocks.BlockChorusGrass;
|
||||
import ru.betterend.blocks.BlockEndLily;
|
||||
import ru.betterend.blocks.BlockEndLilySeed;
|
||||
import ru.betterend.blocks.BlockEndLotusFlower;
|
||||
import ru.betterend.blocks.BlockEndLotusStem;
|
||||
import ru.betterend.blocks.BlockEndstoneDust;
|
||||
import ru.betterend.blocks.BlockGlowingMoss;
|
||||
import ru.betterend.blocks.BlockMossyGlowshroomCap;
|
||||
|
@ -69,6 +71,10 @@ public class BlockRegistry {
|
|||
public static final Block PYTHADENDRON_LEAVES = registerBlock("pythadendron_leaves", new BlockLeaves(MaterialColor.MAGENTA));
|
||||
public static final WoodenMaterial PYTHADENDRON = new WoodenMaterial("pythadendron", MaterialColor.MAGENTA, MaterialColor.PURPLE);
|
||||
|
||||
public static final Block END_LOTUS_STEM = registerBlock("end_lotus_stem", new BlockEndLotusStem());
|
||||
public static final Block END_LOTUS_FLOWER = registerBlockNI("end_lotus_flower", new BlockEndLotusFlower());
|
||||
public static final WoodenMaterial END_LOTUS = new WoodenMaterial("end_lotus", MaterialColor.LIGHT_BLUE, MaterialColor.CYAN);
|
||||
|
||||
// Small Plants //
|
||||
public static final Block UMBRELLA_MOSS = registerBlock("umbrella_moss", new BlockUmbrellaMoss());
|
||||
public static final Block UMBRELLA_MOSS_TALL = registerBlock("umbrella_moss_tall", new BlockUmbrellaMossTall());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue