Skip to content

Commit

Permalink
update hunter table by FoxPrince & Grid
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheaterpaul committed Nov 17, 2023
1 parent 1018376 commit f4da11f
Show file tree
Hide file tree
Showing 9 changed files with 1,118 additions and 963 deletions.

This file was deleted.

61 changes: 39 additions & 22 deletions src/main/java/de/teamlapen/vampirism/blocks/HunterTableBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,36 @@
*/
public class HunterTableBlock extends VampirismHorizontalBlock {
public static final EnumProperty<TABLE_VARIANT> VARIANT = EnumProperty.create("variant", TABLE_VARIANT.class);
private static final VoxelShape SOUTH = makeShape();
private static final VoxelShape WEST = UtilLib.rotateShape(SOUTH, UtilLib.RotationAmount.NINETY);
private static final VoxelShape NORTH = UtilLib.rotateShape(SOUTH, UtilLib.RotationAmount.HUNDRED_EIGHTY);
private static final VoxelShape EAST = UtilLib.rotateShape(SOUTH, UtilLib.RotationAmount.TWO_HUNDRED_SEVENTY);
private static final VoxelShape NORTH = makeShape();
private static final VoxelShape NORTH_HAMMER = Shapes.or(makeShape(), makeHammerShape());
private static final VoxelShape EAST = UtilLib.rotateShape(NORTH, UtilLib.RotationAmount.NINETY);
private static final VoxelShape EAST_HAMMER = UtilLib.rotateShape(NORTH_HAMMER, UtilLib.RotationAmount.NINETY);
private static final VoxelShape SOUTH = UtilLib.rotateShape(NORTH, UtilLib.RotationAmount.HUNDRED_EIGHTY);
private static final VoxelShape SOUTH_HAMMER = UtilLib.rotateShape(NORTH_HAMMER, UtilLib.RotationAmount.HUNDRED_EIGHTY);
private static final VoxelShape WEST = UtilLib.rotateShape(NORTH, UtilLib.RotationAmount.TWO_HUNDRED_SEVENTY);
private static final VoxelShape WEST_HAMMER = UtilLib.rotateShape(NORTH_HAMMER, UtilLib.RotationAmount.TWO_HUNDRED_SEVENTY);

private static @NotNull VoxelShape makeShape() {
VoxelShape a = Block.box(0, 0, 0, 2, 10, 2);
VoxelShape b = Block.box(14, 0, 0, 16, 10, 2);
VoxelShape c = Block.box(0, 0, 14, 2, 10, 16);
VoxelShape d = Block.box(14, 0, 14, 16, 10, 16);

VoxelShape e = Block.box(1, 8, 1, 15, 10, 15);
VoxelShape f = Block.box(8.5, 10, 3.5, 13.5, 11, 10);

VoxelShape d1 = Shapes.or(a, b);
VoxelShape d2 = Shapes.or(c, d);
VoxelShape shape = Shapes.empty();
shape = Shapes.or(shape, Shapes.box(0.125, 0.625, 0.375, 0.5, 0.6875, 0.875));
shape = Shapes.or(shape, Shapes.box(0.125, 0.75, 0.375, 0.5, 0.8125, 0.875));
shape = Shapes.or(shape, Shapes.box(0.125, 0.6875, 0.375, 0.1875, 0.75, 0.875));
shape = Shapes.or(shape, Shapes.box(0.1875, 0.6875, 0.40625, 0.46875, 0.75, 0.84375));
shape = Shapes.or(shape, Shapes.box(0, 0.5, 0, 1, 0.625, 1));
shape = Shapes.or(shape, Shapes.box(0.0625, 0, 0.75, 0.25, 0.5, 0.9375));
shape = Shapes.or(shape, Shapes.box(0.75, 0, 0.75, 0.9375, 0.5, 0.9375));
shape = Shapes.or(shape, Shapes.box(0.75, 0, 0.0625, 0.9375, 0.5, 0.25));
shape = Shapes.or(shape, Shapes.box(0.0625, 0, 0.0625, 0.25, 0.5, 0.25));

return shape;
}

VoxelShape d3 = Shapes.or(d1, d2);
VoxelShape f1 = Shapes.or(e, f);
private static @NotNull VoxelShape makeHammerShape() {
VoxelShape shape = Shapes.empty();
shape = Shapes.or(shape, Shapes.box(0.4375, 0, 0.5625, 0.75, 0.1875, 0.75));
shape = Shapes.or(shape, Shapes.box(0.5625, 0.1875, 0.625, 0.625, 0.624375, 0.6875));

return Shapes.or(d3, f1);
return shape;
}

public static @NotNull TABLE_VARIANT getTierFor(boolean weapon_table, boolean potion_table, boolean cauldron) {
Expand All @@ -72,11 +81,19 @@ public HunterTableBlock() {
@NotNull
@Override
public VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter worldIn, @NotNull BlockPos pos, @NotNull CollisionContext context) {
return switch (state.getValue(FACING)) {
case EAST -> EAST;
case SOUTH -> SOUTH;
case WEST -> WEST;
default -> NORTH;
return switch (state.getValue(VARIANT)) {
default -> switch (state.getValue(FACING)) {
case EAST -> EAST;
case SOUTH -> SOUTH;
case WEST -> WEST;
default -> NORTH;
};
case WEAPON_CAULDRON, WEAPON_POTION, COMPLETE, WEAPON -> switch (state.getValue(FACING)) {
case EAST -> EAST_HAMMER;
case SOUTH -> SOUTH_HAMMER;
case WEST -> WEST_HAMMER;
default -> NORTH_HAMMER;
};
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ protected void registerModels() {
block(ModBlocks.GARLIC_DIFFUSER_NORMAL.get(), "garlic_diffuser_normal");
block(ModBlocks.GARLIC_DIFFUSER_IMPROVED.get(), "garlic_diffuser_improved");

block(ModBlocks.HUNTER_TABLE.get(), "hunter_table/hunter_table");

withExistingParent(ModBlocks.DARK_SPRUCE_LEAVES.get(), mcLoc("block/oak_leaves"));

withExistingParent(ModBlocks.DARK_SPRUCE_SAPLING.get(), mcLoc("item/generated")).texture("layer0", REFERENCE.MODID + ":block/dark_spruce_sapling");
Expand Down
Loading

0 comments on commit f4da11f

Please sign in to comment.