Skip to content

Commit

Permalink
various changes
Browse files Browse the repository at this point in the history
- cropped floor chair texture mapping
- actually good shift-wrench use
  • Loading branch information
rhysdh540 committed Oct 24, 2023
1 parent 162af11 commit 0458d56
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build
.gradle
run
.DS_Store
src/main/resources/assets/create
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,14 @@ public void updateEntityAfterFallOn(BlockGetter reader, Entity entity) {
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
Level world = context.getLevel();
BlockPos pos = context.getClickedPos();
Direction face = context.getClickedFace();

Vec3 clickPos = pos.getCenter().subtract(context.getClickLocation());

state = switch(state.getValue(FACING)) {
case NORTH ->
face == Direction.SOUTH ? toggleBackCrop(state) :
(clickPos.x > 0 ? toggleLeft(state) : toggleRight(state));
case SOUTH ->
face == Direction.NORTH ? toggleBackCrop(state) :
clickPos.x < 0 ? toggleLeft(state) : toggleRight(state);
case WEST ->
face == Direction.EAST ? toggleBackCrop(state) :
clickPos.z < 0 ? toggleLeft(state) : toggleRight(state);
case EAST ->
face == Direction.WEST ? toggleBackCrop(state) :
clickPos.z > 0 ? toggleLeft(state) : toggleRight(state);
case NORTH -> clickPos.x > 0 ? toggleLeft(state) : toggleRight(state);
case SOUTH -> clickPos.x < 0 ? toggleLeft(state) : toggleRight(state);
case WEST -> clickPos.z < 0 ? toggleLeft(state) : toggleRight(state);
case EAST -> clickPos.z > 0 ? toggleLeft(state) : toggleRight(state);
default -> state;
};

Expand Down Expand Up @@ -153,10 +144,7 @@ public InteractionResult onSneakWrenched(BlockState state, UseOnContext context)
BlockPos pos = context.getClickedPos();

if(!world.isClientSide) {
world.setBlock(pos, state.setValue(ARMRESTS, switch(state.getValue(ARMRESTS)) {
case BOTH, LEFT, RIGHT -> NONE;
case NONE -> BOTH;
}), 3);
world.setBlock(pos, toggleBackCrop(state), 3);
}

return InteractionResult.SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"east": {"uv": [0, 5, 16, 0], "rotation": 270, "texture": "#side_top"},
"south": {"uv": [0, 16, 16, 0], "texture": "#side_top"},
"west": {"uv": [0, 5, 16, 0], "rotation": 90, "texture": "#side_top"},
"up": {"uv": [0, 8, 16, 13], "texture": "#top"},
"up": {"uv": [0, 8, 16, 13], "texture": "#side_top"},
"down": {"uv": [0, 0, 16, 8], "texture": "#missing"}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"east": {"uv": [0, 5, 16, 0], "rotation": 270, "texture": "#side_top"},
"south": {"uv": [0, 16, 16, 0], "texture": "#side_top"},
"west": {"uv": [0, 5, 16, 0], "rotation": 90, "texture": "#side_top"},
"up": {"uv": [0, 8, 16, 13], "texture": "#top"},
"up": {"uv": [0, 8, 16, 13], "texture": "#side_top"},
"down": {"uv": [0, 0, 16, 8], "texture": "#missing"}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"east": {"uv": [0, 5, 16, 0], "rotation": 270, "texture": "#side_top"},
"south": {"uv": [0, 16, 16, 0], "texture": "#side_top"},
"west": {"uv": [0, 5, 16, 0], "rotation": 90, "texture": "#side_top"},
"up": {"uv": [0, 8, 16, 13], "texture": "#top"},
"up": {"uv": [0, 8, 16, 13], "texture": "#side_top"},
"down": {"uv": [0, 0, 16, 8], "texture": "#missing"}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"east": {"uv": [0, 5, 16, 0], "rotation": 270, "texture": "#side_top"},
"south": {"uv": [0, 16, 16, 0], "texture": "#side_top"},
"west": {"uv": [0, 5, 16, 0], "rotation": 90, "texture": "#side_top"},
"up": {"uv": [0, 8, 16, 13], "texture": "#top"},
"up": {"uv": [0, 8, 16, 13], "texture": "#side_top"},
"down": {"uv": [0, 0, 16, 8], "texture": "#missing"}
}
},
Expand Down

0 comments on commit 0458d56

Please sign in to comment.