Skip to content

Commit

Permalink
Fix Nightstand, Desk, Side table, and Table z-fighting (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexNijjar committed Oct 22, 2023
1 parent bbd0f6f commit 1d799fb
Show file tree
Hide file tree
Showing 23 changed files with 158 additions and 283 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
- Fix containers not dropping contents (#65)
- Fix couch and metal bench shading (#63)
- Fix counter lighting (#63)
- Fix corner trim lighting
- Fix corner trim lighting
- Fix Nightstand, Desk, Side table, and Table z-fighting (#63)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import earth.terrarium.handcrafted.common.blockentities.ContainerBlockEntity;
import earth.terrarium.handcrafted.common.constants.ConstantComponents;
import earth.terrarium.handcrafted.common.tags.ModItemTags;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
Expand Down Expand Up @@ -48,7 +49,7 @@ public DeskBlock(Properties properties) {
@Override
public @NotNull InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (level.isClientSide()) return InteractionResult.PASS;
if (level.getBlockEntity(pos) instanceof ContainerBlockEntity container) {
if (hand == InteractionHand.MAIN_HAND && !player.getItemInHand(hand).is(ModItemTags.SHEETS) && level.getBlockEntity(pos) instanceof ContainerBlockEntity container) {
player.openMenu(container);
}
return super.use(state, level, pos, player, hand, hit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import earth.terrarium.handcrafted.common.blockentities.ContainerBlockEntity;
import earth.terrarium.handcrafted.common.constants.ConstantComponents;
import earth.terrarium.handcrafted.common.tags.ModItemTags;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
Expand Down Expand Up @@ -48,7 +49,7 @@ public NightstandBlock(Properties properties) {
@Override
public @NotNull InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (level.isClientSide()) return InteractionResult.PASS;
if (level.getBlockEntity(pos) instanceof ContainerBlockEntity container) {
if (hand == InteractionHand.MAIN_HAND && !player.getItemInHand(hand).is(ModItemTags.SHEETS) && level.getBlockEntity(pos) instanceof ContainerBlockEntity container) {
player.openMenu(container);
}
return super.use(state, level, pos, player, hand, hit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import earth.terrarium.handcrafted.common.blockentities.ContainerBlockEntity;
import earth.terrarium.handcrafted.common.constants.ConstantComponents;
import earth.terrarium.handcrafted.common.tags.ModItemTags;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
Expand Down Expand Up @@ -48,7 +49,7 @@ public SideTableBlock(Properties properties) {
@Override
public @NotNull InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (level.isClientSide()) return InteractionResult.PASS;
if (level.getBlockEntity(pos) instanceof ContainerBlockEntity container) {
if (hand == InteractionHand.MAIN_HAND && !player.getItemInHand(hand).is(ModItemTags.SHEETS) && level.getBlockEntity(pos) instanceof ContainerBlockEntity container) {
player.openMenu(container);
}
return super.use(state, level, pos, player, hand, hit);
Expand Down
88 changes: 32 additions & 56 deletions common/src/main/resources/assets/handcrafted/models/block/desk.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
{
"from": [0, 12, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [4, 4, 8, 5], "texture": "#0"},
"east": {"uv": [0, 4, 4, 5], "texture": "#0"},
Expand All @@ -24,7 +23,6 @@
{
"from": [2, 3, 2],
"to": [14, 12, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [3, 11, 6, 13.25], "texture": "#0"},
"east": {"uv": [0, 11, 3, 13.25], "texture": "#0"},
Expand All @@ -37,7 +35,6 @@
{
"from": [12, 0, 12],
"to": [15, 12, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [0.75, 0.75, 1.5, 3.75], "texture": "#0"},
"east": {"uv": [0, 0.75, 0.75, 3.75], "texture": "#0"},
Expand All @@ -50,7 +47,6 @@
{
"from": [12, 0, 1],
"to": [15, 12, 4],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [0.75, 0.75, 1.5, 3.75], "texture": "#0"},
"east": {"uv": [0, 0.75, 0.75, 3.75], "texture": "#0"},
Expand All @@ -63,7 +59,6 @@
{
"from": [1, 0, 1],
"to": [4, 12, 4],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [0.75, 0.75, 1.5, 3.75], "texture": "#0"},
"east": {"uv": [0, 0.75, 0.75, 3.75], "texture": "#0"},
Expand All @@ -76,7 +71,6 @@
{
"from": [1, 0, 12],
"to": [4, 12, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [0.75, 0.75, 1.5, 3.75], "texture": "#0"},
"east": {"uv": [0, 0.75, 0.75, 3.75], "texture": "#0"},
Expand All @@ -87,9 +81,32 @@
}
},
{
"from": [0, 8, -0.01],
"to": [16, 16, -0.01],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"from": [16.1, 8, -0.1],
"to": [16.1, 16.1, 16.1],
"faces": {
"north": {"uv": [7, 8, 7, 10], "texture": "#1"},
"east": {"uv": [3, 8, 7, 10], "texture": "#1"},
"south": {"uv": [11, 8, 11, 10], "texture": "#1"},
"west": {"uv": [7, 8, 11, 10], "texture": "#1"},
"up": {"uv": [7, 8, 7, 4], "texture": "#1"},
"down": {"uv": [7, 4, 7, 8], "texture": "#1"}
}
},
{
"from": [-0.1, 8, -0.1],
"to": [-0.1, 16.1, 16.1],
"faces": {
"north": {"uv": [8, 8, 8, 10], "texture": "#1"},
"east": {"uv": [4, 8, 8, 10], "texture": "#1"},
"south": {"uv": [12, 8, 12, 10], "texture": "#1"},
"west": {"uv": [8, 8, 12, 10], "texture": "#1"},
"up": {"uv": [8, 8, 8, 4], "texture": "#1"},
"down": {"uv": [8, 4, 8, 8], "texture": "#1"}
}
},
{
"from": [-0.1, 8, 16.1],
"to": [16.1, 16.1, 16.1],
"faces": {
"north": {"uv": [0, 8, 4, 10], "texture": "#1"},
"east": {"uv": [0, 8, 0, 10], "texture": "#1"},
Expand All @@ -100,9 +117,8 @@
}
},
{
"from": [0, 16.01, 0],
"to": [16, 16.01, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"from": [-0.1, 16.1, -0.1],
"to": [16.1, 16.1, 16.1],
"faces": {
"north": {"uv": [4, 14, 8, 14], "texture": "#1"},
"east": {"uv": [0, 14, 4, 14], "texture": "#1"},
Expand All @@ -113,9 +129,8 @@
}
},
{
"from": [0, 8, 16.01],
"to": [16, 16, 16.01],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"from": [-0.1, 8, -0.1],
"to": [16.1, 16.1, -0.1],
"faces": {
"north": {"uv": [0, 8, 4, 10], "texture": "#1"},
"east": {"uv": [0, 8, 0, 10], "texture": "#1"},
Expand All @@ -124,53 +139,14 @@
"up": {"uv": [4, 8, 0, 8], "texture": "#1"},
"down": {"uv": [8, 8, 4, 8], "texture": "#1"}
}
},
{
"from": [-0.005, 8, 0.01],
"to": [-0.005, 16, 16.01],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [8, 8, 8, 10], "texture": "#1"},
"east": {"uv": [4, 8, 8, 10], "texture": "#1"},
"south": {"uv": [12, 8, 12, 10], "texture": "#1"},
"west": {"uv": [8, 8, 12, 10], "texture": "#1"},
"up": {"uv": [8, 8, 8, 4], "texture": "#1"},
"down": {"uv": [8, 4, 8, 8], "texture": "#1"}
}
},
{
"from": [16.001, 8, 0.01],
"to": [16.001, 16, 16.01],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [12, 8, 12, 10], "texture": "#1"},
"east": {"uv": [8, 8, 12, 10], "texture": "#1"},
"south": {"uv": [16, 8, 16, 10], "texture": "#1"},
"west": {"uv": [12, 8, 16, 10], "texture": "#1"},
"up": {"uv": [12, 8, 12, 4], "texture": "#1"},
"down": {"uv": [12, 4, 12, 8], "texture": "#1"}
}
}
],
"groups": [
{
"name": "main",
"name": "sheet",
"origin": [8, 0, 8],
"color": 0,
"children": [
0,
1,
2,
3,
4,
5,
{
"name": "sheet",
"origin": [8, 0, 8],
"color": 0,
"children": [6, 7, 8, 9, 10]
}
]
"children": [6, 7, 8, 9, 10]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
{
"from": [0, 12, 0],
"to": [16, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [4, 4, 8, 5], "texture": "#0"},
"east": {"uv": [0, 4, 4, 5], "texture": "#0"},
Expand All @@ -24,7 +23,6 @@
{
"from": [12, 0, 12],
"to": [15, 12, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [0.75, 0.75, 1.5, 3.75], "texture": "#0"},
"east": {"uv": [0, 0.75, 0.75, 3.75], "texture": "#0"},
Expand All @@ -37,7 +35,6 @@
{
"from": [12, 0, 1],
"to": [15, 12, 4],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [0.75, 0.75, 1.5, 3.75], "texture": "#0"},
"east": {"uv": [0, 0.75, 0.75, 3.75], "texture": "#0"},
Expand All @@ -50,7 +47,6 @@
{
"from": [1, 0, 1],
"to": [4, 12, 4],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [0.75, 0.75, 1.5, 3.75], "texture": "#0"},
"east": {"uv": [0, 0.75, 0.75, 3.75], "texture": "#0"},
Expand All @@ -63,7 +59,6 @@
{
"from": [1, 0, 12],
"to": [4, 12, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [0.75, 0.75, 1.5, 3.75], "texture": "#0"},
"east": {"uv": [0, 0.75, 0.75, 3.75], "texture": "#0"},
Expand All @@ -76,7 +71,6 @@
{
"from": [2, 0, 2],
"to": [14, 12, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"faces": {
"north": {"uv": [3, 11, 6, 14], "texture": "#0"},
"east": {"uv": [0, 11, 3, 14], "texture": "#0"},
Expand All @@ -87,9 +81,8 @@
}
},
{
"from": [16.001, 8, -0.01],
"to": [16.001, 16, 15.99],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"from": [16.1, 8, -0.1],
"to": [16.1, 16.1, 16.1],
"faces": {
"north": {"uv": [7, 8, 7, 10], "texture": "#1"},
"east": {"uv": [3, 8, 7, 10], "texture": "#1"},
Expand All @@ -100,9 +93,8 @@
}
},
{
"from": [-0.005, 8, -0.01],
"to": [-0.005, 16, 15.99],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"from": [-0.1, 8, -0.1],
"to": [-0.1, 16.1, 16.1],
"faces": {
"north": {"uv": [8, 8, 8, 10], "texture": "#1"},
"east": {"uv": [4, 8, 8, 10], "texture": "#1"},
Expand All @@ -113,9 +105,8 @@
}
},
{
"from": [0, 8, 16.01],
"to": [16, 16, 16.01],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"from": [-0.1, 8, 16.1],
"to": [16.1, 16.1, 16.1],
"faces": {
"north": {"uv": [0, 8, 4, 10], "texture": "#1"},
"east": {"uv": [0, 8, 0, 10], "texture": "#1"},
Expand All @@ -126,9 +117,8 @@
}
},
{
"from": [0, 16.01, 0],
"to": [16, 16.01, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"from": [-0.1, 16.1, -0.1],
"to": [16.1, 16.1, 16.1],
"faces": {
"north": {"uv": [4, 14, 8, 14], "texture": "#1"},
"east": {"uv": [0, 14, 4, 14], "texture": "#1"},
Expand All @@ -139,9 +129,8 @@
}
},
{
"from": [0, 8, -0.01],
"to": [16, 16, -0.01],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
"from": [-0.1, 8, -0.1],
"to": [16.1, 16.1, -0.1],
"faces": {
"north": {"uv": [0, 8, 4, 10], "texture": "#1"},
"east": {"uv": [0, 8, 0, 10], "texture": "#1"},
Expand All @@ -153,24 +142,17 @@
}
],
"groups": [
0,
1,
2,
3,
4,
5,
{
"name": "main",
"name": "sheet",
"origin": [8, 0, 8],
"color": 0,
"children": [
0,
1,
2,
3,
4,
5,
{
"name": "sheet",
"origin": [8, 0, 8],
"color": 0,
"children": [6, 7, 8, 9, 10]
}
]
"children": [6, 7, 8, 9, 10]
}
]
}
Loading

0 comments on commit 1d799fb

Please sign in to comment.