diff --git a/src/main/java/ru/betterend/blocks/BlockEndLotusFlower.java b/src/main/java/ru/betterend/blocks/BlockEndLotusFlower.java new file mode 100644 index 00000000..77808b96 --- /dev/null +++ b/src/main/java/ru/betterend/blocks/BlockEndLotusFlower.java @@ -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; + } +} diff --git a/src/main/java/ru/betterend/blocks/BlockEndLotusStem.java b/src/main/java/ru/betterend/blocks/BlockEndLotusStem.java new file mode 100644 index 00000000..991fdbee --- /dev/null +++ b/src/main/java/ru/betterend/blocks/BlockEndLotusStem.java @@ -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 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; + } +} diff --git a/src/main/java/ru/betterend/registry/BlockRegistry.java b/src/main/java/ru/betterend/registry/BlockRegistry.java index 9422f8ee..afa5d69c 100644 --- a/src/main/java/ru/betterend/registry/BlockRegistry.java +++ b/src/main/java/ru/betterend/registry/BlockRegistry.java @@ -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()); diff --git a/src/main/resources/assets/betterend/blockstates/end_lotus_flower.json b/src/main/resources/assets/betterend/blockstates/end_lotus_flower.json new file mode 100644 index 00000000..2c056c02 --- /dev/null +++ b/src/main/resources/assets/betterend/blockstates/end_lotus_flower.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "betterend:block/end_lotus_flower" } + } +} diff --git a/src/main/resources/assets/betterend/blockstates/end_lotus_stem.json b/src/main/resources/assets/betterend/blockstates/end_lotus_stem.json new file mode 100644 index 00000000..88620981 --- /dev/null +++ b/src/main/resources/assets/betterend/blockstates/end_lotus_stem.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "betterend:block/end_lotus_stem" } + } +} diff --git a/src/main/resources/assets/betterend/models/block/end_lotus_flower.json b/src/main/resources/assets/betterend/models/block/end_lotus_flower.json new file mode 100644 index 00000000..72a5e8fc --- /dev/null +++ b/src/main/resources/assets/betterend/models/block/end_lotus_flower.json @@ -0,0 +1,152 @@ +{ + "__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio", + "textures": { + "particle": "betterend:block/end_lotus_center", + "texture": "betterend:block/end_lotus_center", + "petal": "betterend:block/end_lotus_petal" + }, + "elements": [ + { + "__comment": "Box1", + "from": [ 4, 0, 4 ], + "to": [ 12, 11, 12 ], + "faces": { + "down": { "uv": [ 8, 8, 16, 16 ], "texture": "#texture" }, + "up": { "uv": [ 8, 0, 16, 8 ], "texture": "#texture" }, + "north": { "uv": [ 0, 4, 8, 16 ], "texture": "#texture" }, + "south": { "uv": [ 0, 5, 8, 16 ], "texture": "#texture" }, + "west": { "uv": [ 0, 5, 8, 16 ], "texture": "#texture" }, + "east": { "uv": [ 0, 5, 8, 16 ], "texture": "#texture" } + } + }, + { + "__comment": "PlaneY2", + "from": [ -0.5, 2, 12 ], + "to": [ 15.5, 2.001, 20 ], + "rotation": { "origin": [ -0.5, 2, 12 ], "axis": "x", "angle": -45 }, + "faces": { + "down": { "uv": [ 16, 8, 0, 16 ], "texture": "#petal" }, + "up": { "uv": [ 0, 8, 16, 16 ], "texture": "#petal", "rotation": 180 } + } + }, + { + "__comment": "PlaneY2", + "from": [ -0.5, 7.5, 17.5 ], + "to": [ 15.5, 7.501, 25.5 ], + "faces": { + "down": { "uv": [ 16, 0, 0, 8 ], "texture": "#petal" }, + "up": { "uv": [ 0, 0, 16, 8 ], "texture": "#petal", "rotation": 180 } + } + }, + { + "__comment": "PlaneY2", + "from": [ 0.5, 1.999, -4 ], + "to": [ 16.5, 2, 4 ], + "rotation": { "origin": [ 0.5, 2, 4 ], "axis": "x", "angle": 45 }, + "faces": { + "down": { "uv": [ 16, 8, 0, 16 ], "texture": "#petal", "rotation": 180 }, + "up": { "uv": [ 0, 8, 16, 16 ], "texture": "#petal" } + } + }, + { + "__comment": "PlaneY2", + "from": [ 0.5, 7.5, -9.5 ], + "to": [ 16.5, 7.501, -1.5 ], + "faces": { + "down": { "uv": [ 16, 0, 0, 8 ], "texture": "#petal", "rotation": 180 }, + "up": { "uv": [ 0, 0, 16, 8 ], "texture": "#petal" } + } + }, + { + "__comment": "PlaneY12", + "from": [ 12, 2, 0.5 ], + "to": [ 20, 2.001, 16.5 ], + "rotation": { "origin": [ 12, 2, 0.5 ], "axis": "z", "angle": 45 }, + "faces": { + "down": { "uv": [ 16, 8, 0, 16 ], "texture": "#petal", "rotation": 90 }, + "up": { "uv": [ 0, 8, 16, 16 ], "texture": "#petal", "rotation": 90 } + } + }, + { + "__comment": "PlaneY12", + "from": [ 17.5, 7.5, 0.5 ], + "to": [ 25.5, 7.501, 16.5 ], + "rotation": { "origin": [ 17.5, 7.5, 0.5 ], "axis": "z", "angle": 0 }, + "faces": { + "down": { "uv": [ 16, 0, 0, 8 ], "texture": "#petal", "rotation": 90 }, + "up": { "uv": [ 0, 0, 16, 8 ], "texture": "#petal", "rotation": 90 } + } + }, + { + "__comment": "PlaneY12", + "from": [ -4, 1.999, -0.5 ], + "to": [ 4, 2, 15.5 ], + "rotation": { "origin": [ 4, 2, -0.5 ], "axis": "z", "angle": -45 }, + "faces": { + "down": { "uv": [ 16, 8, 0, 16 ], "texture": "#petal", "rotation": 270 }, + "up": { "uv": [ 0, 8, 16, 16 ], "texture": "#petal", "rotation": 270 } + } + }, + { + "__comment": "PlaneY12", + "from": [ -9.5, 7.5, -0.5 ], + "to": [ -1.5, 7.501, 15.5 ], + "faces": { + "down": { "uv": [ 16, 0, 0, 8 ], "texture": "#petal", "rotation": 270 }, + "up": { "uv": [ 0, 0, 16, 8 ], "texture": "#petal", "rotation": 270 } + } + }, + { + "__comment": "PlaneY10", + "from": [ 15.5, 2, -10.5 ], + "to": [ 31.5, 2.001, 5.5 ], + "rotation": { "origin": [ 15.5, 2, -10.5 ], "axis": "y", "angle": -45 }, + "faces": { + "down": { "uv": [ 16, 0, 0, 16 ], "texture": "#petal", "rotation": 180 }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#petal" } + } + }, + { + "__comment": "PlaneY10", + "from": [ 10.5, 2, -0.5 ], + "to": [ 26.5, 2.001, 15.5 ], + "rotation": { "origin": [ 26.5, 2, 15.5 ], "axis": "y", "angle": 45 }, + "faces": { + "down": { "uv": [ 16, 0, 0, 16 ], "texture": "#petal" }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#petal", "rotation": 180 } + } + }, + { + "__comment": "PlaneY10", + "from": [ -15.5, 2, 10.5 ], + "to": [ 0.5, 2.001, 26.5 ], + "rotation": { "origin": [ 0.5, 2, 26.5 ], "axis": "y", "angle": -45 }, + "faces": { + "down": { "uv": [ 16, 0, 0, 16 ], "texture": "#petal" }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#petal", "rotation": 180 } + } + }, + { + "__comment": "PlaneY10", + "from": [ -10.4999, 2, 0.4999 ], + "to": [ 5.5001, 2.001, 16.4999 ], + "rotation": { "origin": [ -10.5, 2, 0.5 ], "axis": "y", "angle": 45 }, + "faces": { + "down": { "uv": [ 16, 0, 0, 16 ], "texture": "#petal", "rotation": 180 }, + "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#petal" } + } + }, + { + "__comment": "Box15", + "from": [ 5, 11, 5 ], + "to": [ 11, 12, 11 ], + "faces": { + "up": { "uv": [ 9, 1, 15, 7 ], "texture": "#texture" }, + "north": { "uv": [ 1, 4, 7, 5 ], "texture": "#texture" }, + "south": { "uv": [ 1, 4, 7, 5 ], "texture": "#texture" }, + "west": { "uv": [ 1, 4, 7, 5 ], "texture": "#texture" }, + "east": { "uv": [ 5, 4, 11, 5 ], "texture": "#texture" } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/betterend/models/block/end_lotus_stem.json b/src/main/resources/assets/betterend/models/block/end_lotus_stem.json new file mode 100644 index 00000000..a0f09a71 --- /dev/null +++ b/src/main/resources/assets/betterend/models/block/end_lotus_stem.json @@ -0,0 +1,23 @@ +{ + "__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio", + "parent": "block/block", + "textures": { + "particle": "betterend:block/end_lotus_stem", + "texture": "betterend:block/end_lotus_stem" + }, + "elements": [ + { + "__comment": "Box1", + "from": [ 5, 0, 5 ], + "to": [ 11, 16, 11 ], + "faces": { + "down": { "uv": [ 6, 0, 12, 6 ], "texture": "#texture", "cullface": "down" }, + "up": { "uv": [ 6, 0, 12, 6 ], "texture": "#texture", "cullface": "up" }, + "north": { "uv": [ 0, 0, 6, 16 ], "texture": "#texture" }, + "south": { "uv": [ 0, 0, 6, 16 ], "texture": "#texture" }, + "west": { "uv": [ 0, 0, 6, 16 ], "texture": "#texture" }, + "east": { "uv": [ 0, 0, 6, 16 ], "texture": "#texture" } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/betterend/models/item/end_lotus_stem.json b/src/main/resources/assets/betterend/models/item/end_lotus_stem.json new file mode 100644 index 00000000..1e0cb5ea --- /dev/null +++ b/src/main/resources/assets/betterend/models/item/end_lotus_stem.json @@ -0,0 +1,3 @@ +{ + "parent": "betterend:block/end_lotus_stem" +} diff --git a/src/main/resources/assets/betterend/textures/block/end_lotus_center.png b/src/main/resources/assets/betterend/textures/block/end_lotus_center.png new file mode 100644 index 00000000..d8f8f88d Binary files /dev/null and b/src/main/resources/assets/betterend/textures/block/end_lotus_center.png differ diff --git a/src/main/resources/assets/betterend/textures/block/end_lotus_petal.png b/src/main/resources/assets/betterend/textures/block/end_lotus_petal.png new file mode 100644 index 00000000..72743bd7 Binary files /dev/null and b/src/main/resources/assets/betterend/textures/block/end_lotus_petal.png differ diff --git a/src/main/resources/assets/betterend/textures/block/end_lotus_stem.png b/src/main/resources/assets/betterend/textures/block/end_lotus_stem.png new file mode 100644 index 00000000..930af799 Binary files /dev/null and b/src/main/resources/assets/betterend/textures/block/end_lotus_stem.png differ