Stem fixes

This commit is contained in:
paulevsGitch 2020-10-22 14:11:07 +03:00
parent 6c640447ed
commit 0b5e8daa81
2 changed files with 16 additions and 5 deletions

View file

@ -1,5 +1,9 @@
package ru.betterend.blocks;
import java.util.Map;
import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -17,6 +21,7 @@ import net.minecraft.util.BlockMirror;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Direction.Axis;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess;
@ -29,7 +34,7 @@ public class BlockEndLotusStem extends BlockBase implements Waterloggable {
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public static final BooleanProperty LEAF = BooleanProperty.of("leaf");
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
private static final VoxelShape VSHAPE = Block.createCuboidShape(6, 0, 6, 10, 16, 10);
private static final Map<Axis, VoxelShape> SHAPES = Maps.newEnumMap(Axis.class);
public BlockEndLotusStem() {
super(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS));
@ -38,7 +43,7 @@ public class BlockEndLotusStem extends BlockBase implements Waterloggable {
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
return VSHAPE;
return SHAPES.get(state.get(FACING).getAxis());
}
@Override
@ -75,4 +80,10 @@ public class BlockEndLotusStem extends BlockBase implements Waterloggable {
}
return state;
}
static {
SHAPES.put(Axis.X, Block.createCuboidShape(0, 6, 6, 16, 10, 10));
SHAPES.put(Axis.Y, Block.createCuboidShape(6, 0, 6, 10, 16, 10));
SHAPES.put(Axis.Z, Block.createCuboidShape(6, 6, 0, 10, 10, 16));
}
}

View file

@ -15,9 +15,9 @@
"leaf=false,shape=bottom,facing=down": { "model": "betterend:block/end_lotus_roots" },
"leaf=false,shape=middle,facing=north": { "model": "betterend:block/end_lotus_stem", "x": 90 },
"leaf=false,shape=middle,facing=south": { "model": "betterend:block/end_lotus_stem", "z": 90 },
"leaf=false,shape=middle,facing=east": { "model": "betterend:block/end_lotus_stem", "x": 90 },
"leaf=false,shape=middle,facing=west": { "model": "betterend:block/end_lotus_stem", "z": 90 },
"leaf=false,shape=middle,facing=south": { "model": "betterend:block/end_lotus_stem", "x": 90 },
"leaf=false,shape=middle,facing=east": { "model": "betterend:block/end_lotus_stem", "x": 90, "y": 90 },
"leaf=false,shape=middle,facing=west": { "model": "betterend:block/end_lotus_stem", "x": 90, "y": 90 },
"leaf=false,shape=middle,facing=up": { "model": "betterend:block/end_lotus_stem" },
"leaf=false,shape=middle,facing=down": { "model": "betterend:block/end_lotus_stem" },