Tons of work on vertical slabs
This commit is contained in:
parent
a0d866d838
commit
b1ac84f9d7
19
src/main/java/tech/nevets/vplus/VPProperties.java
Normal file
19
src/main/java/tech/nevets/vplus/VPProperties.java
Normal file
@ -0,0 +1,19 @@
|
||||
package tech.nevets.vplus;
|
||||
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import tech.nevets.vplus.blocks.enums.VerticalSlabType;
|
||||
|
||||
public class VPProperties extends Properties {
|
||||
public static final DirectionProperty VERTICAL_FACING;
|
||||
public static final EnumProperty<VerticalSlabType> VERTICAL_SLAB_TYPE;
|
||||
|
||||
public VPProperties() {}
|
||||
|
||||
static {
|
||||
VERTICAL_FACING = DirectionProperty.of("facing", Direction.Type.VERTICAL);
|
||||
VERTICAL_SLAB_TYPE = EnumProperty.of("type", VerticalSlabType.class);
|
||||
}
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
package tech.nevets.vplus.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import tech.nevets.vplus.items.VPItemGroups;
|
||||
@ -22,7 +24,48 @@ public class VPBlocks {
|
||||
public static final Block JADE_BLOCK;
|
||||
public static final Block LAVA_SPONGE_BLOCK;
|
||||
public static final Block SATURATED_LAVA_SPONGE_BLOCK;
|
||||
|
||||
|
||||
// Vertical Slabs
|
||||
public static final Block VERTICAL_OAK_SLAB;
|
||||
public static final Block VERTICAL_SPRUCE_SLAB;
|
||||
public static final Block VERTICAL_BIRCH_SLAB;
|
||||
public static final Block VERTICAL_JUNGLE_SLAB;
|
||||
public static final Block VERTICAL_ACACIA_SLAB;
|
||||
public static final Block VERTICAL_DARK_OAK_SLAB;
|
||||
public static final Block VERTICAL_CRIMSON_SLAB;
|
||||
public static final Block VERTICAL_WARPED_SLAB;
|
||||
public static final Block VERTICAL_STONE_SLAB;
|
||||
public static final Block VERTICAL_SMOOTH_STONE_SLAB;
|
||||
public static final Block VERTICAL_SANDSTONE_SLAB;
|
||||
public static final Block VERTICAL_CUT_SANDSTONE_SLAB;
|
||||
public static final Block VERTICAL_COBBLESTONE_SLAB;
|
||||
public static final Block VERTICAL_BRICK_SLAB;
|
||||
public static final Block VERTICAL_STONE_BRICK_SLAB;
|
||||
public static final Block VERTICAL_NETHER_BRICK_SLAB;
|
||||
public static final Block VERTICAL_QUARTZ_SLAB;
|
||||
public static final Block VERTICAL_RED_SANDSTONE_SLAB;
|
||||
public static final Block VERTICAL_CUT_RED_SANDSTONE_SLAB;
|
||||
public static final Block VERTICAL_PURPUR_SLAB;
|
||||
public static final Block VERTICAL_PRISMARINE_SLAB;
|
||||
public static final Block VERTICAL_PRISMARINE_BRICK_SLAB;
|
||||
public static final Block VERTICAL_DARK_PRISMARINE_SLAB;
|
||||
public static final Block VERTICAL_POLISHED_GRANITE_SLAB;
|
||||
public static final Block VERTICAL_SMOOTH_RED_SANDSTONE_SLAB;
|
||||
public static final Block VERTICAL_MOSSY_STONE_BRICK_SLAB;
|
||||
public static final Block VERTICAL_POLISHED_DIORITE_SLAB;
|
||||
public static final Block VERTICAL_MOSSY_COBBLESTONE_SLAB;
|
||||
public static final Block VERTICAL_END_STONE_BRICK_SLAB;
|
||||
public static final Block VERTICAL_SMOOTH_SANDSTONE_SLAB;
|
||||
public static final Block VERTICAL_SMOOTH_QUARTZ_SLAB;
|
||||
public static final Block VERTICAL_GRANITE_SLAB;
|
||||
public static final Block VERTICAL_ANDESITE_SLAB;
|
||||
public static final Block VERTICAL_RED_NETHER_BRICK_SLAB;
|
||||
public static final Block VERTICAL_POLISHED_ANDESITE_SLAB;
|
||||
public static final Block VERTICAL_DIORITE_SLAB;
|
||||
public static final Block VERTICAL_BLACKSTONE_SLAB;
|
||||
public static final Block VERTICAL_POLISHED_BLACKSTONE_SLAB;
|
||||
public static final Block VERTICAL_POLISHED_BLACKSTONE_BRICK_SLAB;
|
||||
|
||||
public VPBlocks() {
|
||||
}
|
||||
|
||||
@ -35,6 +78,50 @@ public class VPBlocks {
|
||||
JADE_BLOCK = register("jade_block", new Block(AbstractBlock.Settings.of(Material.METAL).requiresTool().strength(3.0F, 3.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
LAVA_SPONGE_BLOCK = register("lava_sponge", new LavaSpongeBlock(), VPItemGroups.BLOCKS).getBlock();
|
||||
SATURATED_LAVA_SPONGE_BLOCK = register("saturated_lava_sponge", new SaturatedLavaSpongeBlock(), VPItemGroups.BLOCKS, new Item.Settings().recipeRemainder(Item.fromBlock(LAVA_SPONGE_BLOCK))).getBlock();
|
||||
|
||||
// Vertical Slabs
|
||||
//TODO add new 1.17 blocks
|
||||
//TODO add new 1.18 blocks
|
||||
//TODO add new 1.19 blocks
|
||||
VERTICAL_OAK_SLAB = register("vertical_oak_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.WOOD).sounds(BlockSoundGroup.WOOD).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_SPRUCE_SLAB = register("vertical_spruce_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.WOOD).sounds(BlockSoundGroup.WOOD).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_BIRCH_SLAB = register("vertical_birch_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.WOOD).sounds(BlockSoundGroup.WOOD).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_JUNGLE_SLAB = register("vertical_jungle_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.WOOD).sounds(BlockSoundGroup.WOOD).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_ACACIA_SLAB = register("vertical_acacia_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.WOOD).sounds(BlockSoundGroup.WOOD).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_DARK_OAK_SLAB = register("vertical_dark_oak_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.WOOD).sounds(BlockSoundGroup.WOOD).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_CRIMSON_SLAB = register("vertical_crimson_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.WOOD).sounds(BlockSoundGroup.WOOD).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_WARPED_SLAB = register("vertical_warped_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.WOOD).sounds(BlockSoundGroup.WOOD).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_STONE_SLAB = register("vertical_stone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_SMOOTH_STONE_SLAB = register("vertical_smooth_stone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_SANDSTONE_SLAB = register("vertical_sandstone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_CUT_SANDSTONE_SLAB = register("vertical_cut_sandstone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_COBBLESTONE_SLAB = register("vertical_cobblestone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_BRICK_SLAB = register("vertical_brick_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_STONE_BRICK_SLAB = register("vertical_stone_brick_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_NETHER_BRICK_SLAB = register("vertical_nether_brick_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_QUARTZ_SLAB = register("vertical_quartz_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_RED_SANDSTONE_SLAB = register("vertical_red_sandstone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_CUT_RED_SANDSTONE_SLAB = register("vertical_cut_red_sandstone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_PURPUR_SLAB = register("vertical_purpur_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_PRISMARINE_SLAB = register("vertical_prismarine_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_PRISMARINE_BRICK_SLAB = register("vertical_prismarine_brick_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_DARK_PRISMARINE_SLAB = register("vertical_dark_prismarine_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_POLISHED_GRANITE_SLAB = register("vertical_polished_granite_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_SMOOTH_RED_SANDSTONE_SLAB = register("vertical_smooth_red_sandstone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_MOSSY_STONE_BRICK_SLAB = register("vertical_mossy_stone_brick_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_POLISHED_DIORITE_SLAB = register("vertical_polished_diorite_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_MOSSY_COBBLESTONE_SLAB = register("vertical_mossy_cobblestone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_END_STONE_BRICK_SLAB = register("vertical_end_stone_brick_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_SMOOTH_SANDSTONE_SLAB = register("vertical_smooth_sandstone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_SMOOTH_QUARTZ_SLAB = register("vertical_smooth_quartz_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_GRANITE_SLAB = register("vertical_granite_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_ANDESITE_SLAB = register("vertical_andesite_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_RED_NETHER_BRICK_SLAB = register("vertical_red_nether_brick_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_POLISHED_ANDESITE_SLAB = register("vertical_polished_andesite_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_DIORITE_SLAB = register("vertical_diorite_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_BLACKSTONE_SLAB = register("vertical_blackstone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_POLISHED_BLACKSTONE_SLAB = register("vertical_polished_blackstone_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
VERTICAL_POLISHED_BLACKSTONE_BRICK_SLAB = register("vertical_polished_blackstone_brick_slab", new VerticalSlabBlock(FabricBlockSettings.of(Material.STONE).sounds(BlockSoundGroup.STONE).hardness(2.0F)), VPItemGroups.BLOCKS).getBlock();
|
||||
|
||||
///////////////////\\\\ITERATOR////\\\\\\\\\\\\\\\\\\\
|
||||
|
||||
@ -50,14 +137,14 @@ public class VPBlocks {
|
||||
Use blockItem.getBlock(); to get instance of the block if needed
|
||||
*/
|
||||
private static BlockItem register(String id, Block block, ItemGroup group) {
|
||||
BLOCKS.add(block);
|
||||
Registry.register(Registry.BLOCK, new Identifier("vplus", id), block);
|
||||
BLOCKS.add(block);
|
||||
return Registry.register(Registry.ITEM, new Identifier("vplus", id), new BlockItem(block, new Item.Settings().group(group)));
|
||||
}
|
||||
|
||||
private static BlockItem register(String id, Block block, ItemGroup group, Item.Settings itemSettings) {
|
||||
BLOCKS.add(block);
|
||||
Registry.register(Registry.BLOCK, new Identifier("vplus", id), block);
|
||||
BLOCKS.add(block);
|
||||
return Registry.register(Registry.ITEM, new Identifier("vplus", id), new BlockItem(block, itemSettings.group(group)));
|
||||
}
|
||||
|
||||
|
142
src/main/java/tech/nevets/vplus/blocks/VerticalSlabBlock.java
Normal file
142
src/main/java/tech/nevets/vplus/blocks/VerticalSlabBlock.java
Normal file
@ -0,0 +1,142 @@
|
||||
package tech.nevets.vplus.blocks;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.enums.SlabType;
|
||||
import net.minecraft.entity.ai.pathing.NavigationType;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.tag.FluidTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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.WorldAccess;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import tech.nevets.vplus.VPProperties;
|
||||
import tech.nevets.vplus.blocks.enums.VerticalSlabType;
|
||||
|
||||
public class VerticalSlabBlock extends HorizontalFacingBlock implements Waterloggable {
|
||||
public static final EnumProperty<VerticalSlabType> TYPE;
|
||||
public static final BooleanProperty WATERLOGGED;
|
||||
private static final VoxelShape NORTH;
|
||||
private static final VoxelShape EAST;
|
||||
private static final VoxelShape SOUTH;
|
||||
private static final VoxelShape WEST;
|
||||
|
||||
public VerticalSlabBlock(Settings settings) {
|
||||
super(settings);
|
||||
setDefaultState(this.stateManager.getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH).with(WATERLOGGED, false));
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean hasSidedTransparency(BlockState state) {
|
||||
// return state.get(TYPE) != VerticalSlabType.DOUBLE;
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||
stateManager.add(Properties.HORIZONTAL_FACING, WATERLOGGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
VerticalSlabType verticalSlabType = state.get(TYPE);
|
||||
Direction dir = state.get(FACING);
|
||||
switch (dir) {
|
||||
case NORTH -> {return NORTH;}
|
||||
case SOUTH -> {return SOUTH;}
|
||||
case EAST -> {return EAST;}
|
||||
case WEST -> {return WEST;}
|
||||
default -> {return VoxelShapes.fullCube();}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||
BlockPos blockPos = ctx.getBlockPos();
|
||||
BlockState blockState = ctx.getWorld().getBlockState(blockPos);
|
||||
if (blockState.isOf(this)) {
|
||||
return blockState.with(TYPE, VerticalSlabType.DOUBLE).with(WATERLOGGED, false);
|
||||
} else {
|
||||
return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getPlayerFacing().getOpposite()).with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
|
||||
if (state.get(WATERLOGGED)) {
|
||||
world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||
}
|
||||
|
||||
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) {
|
||||
switch (type) {
|
||||
case WATER -> {return world.getFluidState(pos).isIn(FluidTags.WATER);}
|
||||
default -> {return false;}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) {
|
||||
Direction dir = state.get(FACING);
|
||||
switch(dir) {
|
||||
case NORTH, SOUTH, EAST, WEST -> {return Waterloggable.super.tryFillWithFluid(world, pos, state, fluidState);}
|
||||
default -> {return false;}
|
||||
} }
|
||||
|
||||
@Override
|
||||
public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) {
|
||||
Direction dir = state.get(FACING);
|
||||
switch(dir) {
|
||||
case NORTH, SOUTH, EAST, WEST -> {return Waterloggable.super.canFillWithFluid(world, pos, state, fluid);}
|
||||
default -> {return false;}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState blockState_1) {
|
||||
return BlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
|
||||
private static VoxelShape rotate(Direction from, Direction to, VoxelShape shape) {
|
||||
VoxelShape[] buffer = new VoxelShape[]{ shape, VoxelShapes.empty() };
|
||||
|
||||
int times = (to.getHorizontal() - from.getHorizontal() + 4) % 4;
|
||||
for (int i = 0; i < times; i++) {
|
||||
buffer[0].forEachBox((minX, minY, minZ, maxX, maxY, maxZ) -> buffer[1] = VoxelShapes.union(buffer[1], VoxelShapes.cuboid(1-maxZ, minY, minX, 1-minZ, maxY, maxX)));
|
||||
buffer[0] = buffer[1];
|
||||
buffer[1] = VoxelShapes.empty();
|
||||
}
|
||||
|
||||
return buffer[0];
|
||||
}
|
||||
|
||||
static {
|
||||
TYPE = VPProperties.VERTICAL_SLAB_TYPE;
|
||||
WATERLOGGED = Properties.WATERLOGGED;
|
||||
|
||||
VoxelShape shape = createCuboidShape(0.0D, 0.0D, 0.0D, 8.0D, 16.0D, 16.0D);
|
||||
|
||||
EAST = shape;
|
||||
NORTH = rotate(Direction.EAST, Direction.NORTH, shape);
|
||||
SOUTH = rotate(Direction.EAST, Direction.SOUTH, shape);
|
||||
WEST = rotate(Direction.EAST, Direction.WEST, shape);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package tech.nevets.vplus.blocks.enums;
|
||||
|
||||
import net.minecraft.util.StringIdentifiable;
|
||||
|
||||
public enum VerticalSlabType implements StringIdentifiable {
|
||||
NORTH("north"),
|
||||
EAST("east"),
|
||||
SOUTH("south"),
|
||||
WEST("west"),
|
||||
DOUBLE("double");
|
||||
|
||||
private final String name;
|
||||
|
||||
VerticalSlabType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
@ -30,5 +30,6 @@ public class VPItems {
|
||||
VPFood.init();
|
||||
VPArmor.init();
|
||||
VPTools.init();
|
||||
VPFuels.init();
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class VPTools {
|
||||
|
||||
private static void register(VPMaterials material, Class<? extends ToolItem> T, String toolName) {
|
||||
try {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", material.getName() + "_" + toolName), T.getConstructor(ToolMaterial.class, Item.Settings.class).newInstance(material, new Item.Settings().group(VPItemGroups.TOOLS)));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", material.getName() + "_" + toolName), T.getConstructor(ToolMaterial.class, Item.Settings.class).newInstance(material, new Item.Settings()));
|
||||
} catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -40,7 +40,7 @@ public class VPTools {
|
||||
private static void registerAll(VPMaterials[] materials, Class<? extends ToolItem> T, String toolName) {
|
||||
for (VPMaterials material : materials) {
|
||||
try {
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", material.getName() + "_" + toolName), T.getConstructor(ToolMaterial.class, Item.Settings.class).newInstance(material, new Item.Settings().group(VPItemGroups.TOOLS)));
|
||||
Registry.register(Registry.ITEM, new Identifier("vplus", material.getName() + "_" + toolName), T.getConstructor(ToolMaterial.class, Item.Settings.class).newInstance(material, new Item.Settings()));
|
||||
} catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -2,11 +2,11 @@
|
||||
"key.vplus.zoom": "Zoom Key",
|
||||
"category.vplus.zoom": "Zoom",
|
||||
|
||||
"itemGroup.vplus.all": "All",
|
||||
"itemGroup.vplus.combat": "Combat",
|
||||
"itemGroup.vplus.tools": "Tools",
|
||||
"itemGroup.vplus.food": "Food",
|
||||
"itemGroup.vplus.vert_slabs": "Vertical Slabs",
|
||||
"itemGroup.vplus.blocksplus": "Blocks Plus",
|
||||
"itemGroup.vplus.itemsplus": "Items Plus",
|
||||
"itemGroup.vplus.combatplus": "Combat",
|
||||
"itemGroup.vplus.toolsplus": "Tools",
|
||||
"itemGroup.vplus.foodplus": "Food",
|
||||
|
||||
"block.vplus.lava_sponge": "Lava Sponge",
|
||||
"block.vplus.saturated_lava_sponge": "Saturated Lava Sponge",
|
||||
@ -15,6 +15,46 @@
|
||||
"block.vplus.ruby_ore": "Ruby Ore",
|
||||
"block.vplus.ruby_block": "Ruby Block",
|
||||
|
||||
"block.vplus.vertical_oak_slab":"Vertical Oak Slab",
|
||||
"block.vplus.vertical_spruce_slab":"Vertical Spruce Slab",
|
||||
"block.vplus.vertical_birch_slab":"Vertical Birch Slab",
|
||||
"block.vplus.vertical_jungle_slab":"Vertical Jungle Slab",
|
||||
"block.vplus.vertical_acacia_slab":"Vertical Acacia Slab",
|
||||
"block.vplus.vertical_dark_oak_slab":"Vertical Dark Oak Slab",
|
||||
"block.vplus.vertical_crimson_slab":"Vertical Crimson Slab",
|
||||
"block.vplus.vertical_warped_slab":"Vertical Warped Slab",
|
||||
"block.vplus.vertical_stone_slab":"Vertical Stone Slab",
|
||||
"block.vplus.vertical_smooth_stone_slab":"Vertical Smooth Stone Slab",
|
||||
"block.vplus.vertical_sandstone_slab":"Vertical Sandstone Slab",
|
||||
"block.vplus.vertical_cut_sandstone_slab":"Vertical Cut Sandstone Slab",
|
||||
"block.vplus.vertical_cobblestone_slab":"Vertical Cobblestone Slab",
|
||||
"block.vplus.vertical_brick_slab":"Vertical Brick Slab",
|
||||
"block.vplus.vertical_stone_brick_slab":"Vertical Stone Brick Slab",
|
||||
"block.vplus.vertical_nether_brick_slab":"Vertical Nether Brick Slab",
|
||||
"block.vplus.vertical_quartz_slab":"Vertical Quartz Slab",
|
||||
"block.vplus.vertical_red_sandstone_slab":"Vertical Red Sandstone Slab",
|
||||
"block.vplus.vertical_cut_red_sandstone_slab":"Vertical Cut Red Sandstone Slab",
|
||||
"block.vplus.vertical_purpur_slab":"Vertical Purpur Slab",
|
||||
"block.vplus.vertical_prismarine_slab":"Vertical Prismarine Slab",
|
||||
"block.vplus.vertical_prismarine_brick_slab":"Vertical Prismarine Brick Slab",
|
||||
"block.vplus.vertical_dark_prismarine_slab":"Vertical Dark Prismarine Slab",
|
||||
"block.vplus.vertical_polished_granite_slab":"Vertical Polished Granite Slab",
|
||||
"block.vplus.vertical_smooth_red_sandstone_slab":"Vertical Smooth Red Sandstone Slab",
|
||||
"block.vplus.vertical_mossy_stone_brick_slab":"Vertical Mossy Stone Brick Slab",
|
||||
"block.vplus.vertical_polished_diorite_slab":"Vertical Polished Diorite Slab",
|
||||
"block.vplus.vertical_mossy_cobblestone_slab":"Vertical Mossy Cobblestone Slab",
|
||||
"block.vplus.vertical_end_stone_brick_slab":"Vertical End Stone Brick Slab",
|
||||
"block.vplus.vertical_smooth_sandstone_slab":"Vertical Smooth Sandstone Slab",
|
||||
"block.vplus.vertical_smooth_quartz_slab":"Vertical Smooth Quartz Slab",
|
||||
"block.vplus.vertical_granite_slab":"Vertical Granite Slab",
|
||||
"block.vplus.vertical_andesite_slab":"Vertical Andesite Slab",
|
||||
"block.vplus.vertical_red_nether_brick_slab":"Vertical Red Nether Brick Slab",
|
||||
"block.vplus.vertical_polished_andesite_slab":"Vertical Polished Andesite Slab",
|
||||
"block.vplus.vertical_diorite_slab":"Vertical Diorite Slab",
|
||||
"block.vplus.vertical_blackstone_slab":"Vertical Blackstone Slab",
|
||||
"block.vplus.vertical_polished_blackstone_slab":"Vertical Polished Blackstone Slab",
|
||||
"block.vplus.vertical_polished_blackstone_brick_slab":"Vertical Polished Blackstone Brick Slab",
|
||||
|
||||
"item.vplus.sapphire": "Sapphire",
|
||||
"item.vplus.ruby": "Ruby",
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user