Improve shape utility

This commit is contained in:
Andrew-71 2023-09-23 14:42:48 +03:00
parent e997a0a281
commit 2a6898b664
8 changed files with 96 additions and 131 deletions

View file

@ -32,9 +32,9 @@ import static net.minecraft.block.StairsBlock.SHAPE;
// By the way, Blockstate not updating when removing stairs is a "creative decision" apparently
// - Andrew71
public class HandrailBlock extends HorizontalFacingBlock implements BlockEntityProvider, Waterloggable {
protected static final Shapes.HorizontalShape2 SHAPE1;
protected static final Shapes.HorizontalShape2 SHAPE2;
protected static final Shapes.HorizontalShape2 SHAPE3;
protected static final Shapes.HorizontalShape SHAPE1;
protected static final Shapes.HorizontalShape SHAPE2;
protected static final Shapes.HorizontalShape SHAPE3;
public static final BooleanProperty WATERLOGGED;
public static final IntProperty ROTATION;
@ -128,9 +128,9 @@ public class HandrailBlock extends HorizontalFacingBlock implements BlockEntityP
}
static {
SHAPE2 = new Shapes.HorizontalShape2(List.of(List.of(0.0, 0.0, 15.0, 16.0, 17.0, 16.0), List.of(0.0, 17.0, 14.5, 16.0, 19.0, 16.5)));
SHAPE1 = new Shapes.HorizontalShape2(List.of(List.of(0.0, 0.0, 15.0, 8.0, 18.0, 16.0), List.of(8.0, -8.0, 15.0, 16.0, 10.0, 16.0)));
SHAPE3 = new Shapes.HorizontalShape2(List.of(List.of(0.0, -8.0, 15.0, 8.0, 10.0, 16.0), List.of(8.0, 0.0, 15.0, 16.0, 18.0, 16.0)));
SHAPE2 = new Shapes.HorizontalShape(List.of(List.of(0.0, 0.0, 15.0, 16.0, 17.0, 16.0), List.of(0.0, 17.0, 14.5, 16.0, 19.0, 16.5)));
SHAPE1 = new Shapes.HorizontalShape(List.of(List.of(0.0, 0.0, 15.0, 8.0, 18.0, 16.0), List.of(8.0, -8.0, 15.0, 16.0, 10.0, 16.0)));
SHAPE3 = new Shapes.HorizontalShape(List.of(List.of(0.0, -8.0, 15.0, 8.0, 10.0, 16.0), List.of(8.0, 0.0, 15.0, 16.0, 18.0, 16.0)));
ROTATION = IntProperty.of("rotate", 1, 3);;
WATERLOGGED = Properties.WATERLOGGED;
}

View file

@ -19,7 +19,7 @@ import su.a71.new_soviet.util.Shapes;
import java.util.List;
public class TVBlock extends HorizontalFacingBlock implements BlockEntityProvider {
protected static final Shapes.HorizontalShape SHAPE;
protected static final Shapes.HorizontalShapeLegacy SHAPE;
public TVBlock(AbstractBlock.Settings settings) {
super(settings.sounds(BlockSoundGroup.METAL).pistonBehavior(PistonBehavior.BLOCK).strength(1f, 2f));
@ -54,6 +54,6 @@ public class TVBlock extends HorizontalFacingBlock implements BlockEntityProvide
}
static {
SHAPE = new Shapes.HorizontalShape(List.of(List.of(0.0, 1.0, 3.0, 16.0, 13.0, 13.0), List.of(2.0, 0.0, 4.0, 14.0, 1.0, 12.0), List.of(6.0, 13.0, 7.0, 10.0, 14.0, 9.0)));
SHAPE = new Shapes.HorizontalShapeLegacy(List.of(List.of(0.0, 1.0, 3.0, 16.0, 13.0, 13.0), List.of(2.0, 0.0, 4.0, 14.0, 1.0, 12.0), List.of(6.0, 13.0, 7.0, 10.0, 14.0, 9.0)));
}
}

View file

@ -1,14 +1,5 @@
package su.a71.new_soviet.blocks.lamps;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
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.WorldView;
import su.a71.new_soviet.util.Shapes;
import java.util.List;
@ -17,7 +8,7 @@ public class DevTableLampBlock extends GoldenTableLampBlock {
public DevTableLampBlock(Settings settings) {
super(settings);
SHAPE = new Shapes.HorizontalShape(List.of(
SHAPE = new Shapes.HorizontalShapeLegacy(List.of(
List.of(5.0, 0.0, 5.0, 11.0, 2.0, 11.0),
List.of(7.0, 2.0, 7.0, 9.0, 4.0, 9.0),
List.of(6.0, 4.0, 6.0, 10.0, 5.0, 10.0),

View file

@ -21,7 +21,7 @@ import java.util.List;
public class GoldenTableLampBlock extends LampBlock {
public static final DirectionProperty FACING;
public Shapes.HorizontalShape SHAPE = new Shapes.HorizontalShape(List.of(
public Shapes.HorizontalShapeLegacy SHAPE = new Shapes.HorizontalShapeLegacy(List.of(
List.of(5.0, 0.0, 5.0, 11.0, 2.0, 11.0),
List.of(7.0, 2.0, 7.0, 9.0, 4.0, 9.0),
List.of(6.0, 4.0, 6.0, 10.0, 5.0, 10.0),

View file

@ -23,14 +23,12 @@ import net.minecraft.world.WorldView;
import org.jetbrains.annotations.Nullable;
import su.a71.new_soviet.util.Shapes;
import java.util.List;
public class LampPostLampBlock extends Block implements Waterloggable {
public static final DirectionProperty FACING;
public static final BooleanProperty WATERLOGGED;
public Shapes.HorizontalShape SHAPE;
public Shapes.HorizontalShapeLegacy SHAPE;
public LampPostLampBlock(AbstractBlock.Settings settings, Shapes.HorizontalShape shape) {
public LampPostLampBlock(AbstractBlock.Settings settings, Shapes.HorizontalShapeLegacy shape) {
super(settings.luminance((state) -> 14));
SHAPE = shape;
this.setDefaultState(this.stateManager.getDefaultState()