107 lines
4.9 KiB
Java
107 lines
4.9 KiB
Java
package com.dairymoose.modernlife.blocks;
|
|
|
|
import com.dairymoose.modernlife.util.ModernLifeUtil;
|
|
import java.util.stream.Stream;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.core.Direction;
|
|
import net.minecraft.world.level.BlockGetter;
|
|
import net.minecraft.world.level.block.Block;
|
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
import net.minecraft.world.level.block.state.StateDefinition;
|
|
import net.minecraft.world.level.block.state.properties.AttachFace;
|
|
import net.minecraft.world.level.block.state.properties.Property;
|
|
import net.minecraft.world.phys.shapes.BooleanOp;
|
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
|
import net.minecraft.world.phys.shapes.Shapes;
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
|
|
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/GlassPanelBlock.class */
|
|
public class GlassPanelBlock extends AbstractPanelBlock {
|
|
protected static final VoxelShape SHAPE_FLOOR_NORTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 0.0d, 16.0d, 1.0d, 16.0d)).reduce((v1, v2) -> {
|
|
return Shapes.join(v1, v2, BooleanOp.OR);
|
|
}).get();
|
|
protected static final VoxelShape SHAPE_WALL_NORTH = (VoxelShape) Stream.of(Block.box(0.0d, 0.0d, 15.0d, 16.0d, 16.0d, 16.0d)).reduce((v1, v2) -> {
|
|
return Shapes.join(v1, v2, BooleanOp.OR);
|
|
}).get();
|
|
protected static final VoxelShape SHAPE_WALL_EAST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WALL_NORTH);
|
|
protected static final VoxelShape SHAPE_WALL_SOUTH = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WALL_EAST);
|
|
protected static final VoxelShape SHAPE_WALL_WEST = ModernLifeUtil.RotateVoxelShapeClockwise(SHAPE_WALL_SOUTH);
|
|
protected static final VoxelShape SHAPE_CEILING_NORTH = (VoxelShape) Stream.of(Block.box(0.0d, 15.0d, 0.0d, 16.0d, 16.0d, 16.0d)).reduce((v1, v2) -> {
|
|
return Shapes.join(v1, v2, BooleanOp.OR);
|
|
}).get();
|
|
|
|
public GlassPanelBlock(Properties props) {
|
|
super(props);
|
|
registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any().setValue(AbstractPanelBlock.FACING, Direction.NORTH)).setValue(AbstractPanelBlock.FACE, AttachFace.FLOOR));
|
|
}
|
|
|
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
|
|
builder.add(new Property[]{AbstractPanelBlock.FACING, AbstractPanelBlock.FACE});
|
|
}
|
|
|
|
/* renamed from: com.dairymoose.modernlife.blocks.GlassPanelBlock$1 */
|
|
/* loaded from: outputsrg.jar:com/dairymoose/modernlife/blocks/GlassPanelBlock$1.class */
|
|
static /* synthetic */ class C00231 {
|
|
static final /* synthetic */ int[] $SwitchMap$net$minecraft$core$Direction;
|
|
|
|
/* renamed from: $SwitchMap$net$minecraft$world$level$block$state$properties$AttachFace */
|
|
static final /* synthetic */ int[] f2x6a19ab39 = new int[AttachFace.values().length];
|
|
|
|
static {
|
|
try {
|
|
f2x6a19ab39[AttachFace.FLOOR.ordinal()] = 1;
|
|
} catch (NoSuchFieldError e) {
|
|
}
|
|
try {
|
|
f2x6a19ab39[AttachFace.WALL.ordinal()] = 2;
|
|
} catch (NoSuchFieldError e2) {
|
|
}
|
|
try {
|
|
f2x6a19ab39[AttachFace.CEILING.ordinal()] = 3;
|
|
} catch (NoSuchFieldError e3) {
|
|
}
|
|
$SwitchMap$net$minecraft$core$Direction = new int[Direction.values().length];
|
|
try {
|
|
$SwitchMap$net$minecraft$core$Direction[Direction.NORTH.ordinal()] = 1;
|
|
} catch (NoSuchFieldError e4) {
|
|
}
|
|
try {
|
|
$SwitchMap$net$minecraft$core$Direction[Direction.EAST.ordinal()] = 2;
|
|
} catch (NoSuchFieldError e5) {
|
|
}
|
|
try {
|
|
$SwitchMap$net$minecraft$core$Direction[Direction.WEST.ordinal()] = 3;
|
|
} catch (NoSuchFieldError e6) {
|
|
}
|
|
try {
|
|
$SwitchMap$net$minecraft$core$Direction[Direction.SOUTH.ordinal()] = 4;
|
|
} catch (NoSuchFieldError e7) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public VoxelShape getShape(BlockState bs, BlockGetter reader, BlockPos pos, CollisionContext sel) {
|
|
switch (C00231.f2x6a19ab39[bs.getValue(AbstractPanelBlock.FACE).ordinal()]) {
|
|
case 1:
|
|
return SHAPE_FLOOR_NORTH;
|
|
case 2:
|
|
switch (C00231.$SwitchMap$net$minecraft$core$Direction[bs.getValue(AbstractPanelBlock.FACING).ordinal()]) {
|
|
case 1:
|
|
return SHAPE_WALL_NORTH;
|
|
case 2:
|
|
return SHAPE_WALL_EAST;
|
|
case 3:
|
|
return SHAPE_WALL_WEST;
|
|
case 4:
|
|
return SHAPE_WALL_SOUTH;
|
|
}
|
|
case 3:
|
|
break;
|
|
default:
|
|
return SHAPE_FLOOR_NORTH;
|
|
}
|
|
return SHAPE_CEILING_NORTH;
|
|
}
|
|
}
|