minecraft-src/net/minecraft/world/level/block/PiglinWallSkullBlock.java
2025-07-04 01:41:11 +03:00

42 lines
1.4 KiB
Java

package net.minecraft.world.level.block;
import com.google.common.collect.Maps;
import com.mojang.serialization.MapCodec;
import java.util.Map;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
public class PiglinWallSkullBlock extends WallSkullBlock {
public static final MapCodec<PiglinWallSkullBlock> CODEC = simpleCodec(PiglinWallSkullBlock::new);
private static final Map<Direction, VoxelShape> AABBS = Maps.immutableEnumMap(
Map.of(
Direction.NORTH,
Block.box(3.0, 4.0, 8.0, 13.0, 12.0, 16.0),
Direction.SOUTH,
Block.box(3.0, 4.0, 0.0, 13.0, 12.0, 8.0),
Direction.EAST,
Block.box(0.0, 4.0, 3.0, 8.0, 12.0, 13.0),
Direction.WEST,
Block.box(8.0, 4.0, 3.0, 16.0, 12.0, 13.0)
)
);
@Override
public MapCodec<PiglinWallSkullBlock> codec() {
return CODEC;
}
public PiglinWallSkullBlock(BlockBehaviour.Properties properties) {
super(SkullBlock.Types.PIGLIN, properties);
}
@Override
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
return (VoxelShape)AABBS.get(state.getValue(FACING));
}
}