From c44f8dc6e95e2abeb5bfa478f1869c9397860b45 Mon Sep 17 00:00:00 2001 From: quat1024 Date: Tue, 11 Jul 2023 03:34:13 -0400 Subject: [PATCH] work around fences/walls/panes being weird --- .../cottonmc/templates/TemplatesClient.java | 11 +-- .../templates/models/block/fence_side.json | 68 +++++++++++++++++++ .../models/block/glass_pane_side.json | 40 +++++++++++ .../models/block/glass_pane_side_alt.json | 40 +++++++++++ .../templates/models/block/wall_side.json | 36 ++++++++++ .../models/block/wall_side_tall.json | 36 ++++++++++ 6 files changed, 226 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/assets/templates/models/block/fence_side.json create mode 100644 src/main/resources/assets/templates/models/block/glass_pane_side.json create mode 100644 src/main/resources/assets/templates/models/block/glass_pane_side_alt.json create mode 100644 src/main/resources/assets/templates/models/block/wall_side.json create mode 100644 src/main/resources/assets/templates/models/block/wall_side_tall.json diff --git a/src/main/java/io/github/cottonmc/templates/TemplatesClient.java b/src/main/java/io/github/cottonmc/templates/TemplatesClient.java index 6c2e55b..81e0534 100644 --- a/src/main/java/io/github/cottonmc/templates/TemplatesClient.java +++ b/src/main/java/io/github/cottonmc/templates/TemplatesClient.java @@ -68,14 +68,11 @@ public class TemplatesClient implements ClientModInitializer { provider.addTemplateModel(Templates.id("carpet_special"), new UnbakedAutoRetexturedModel(new Identifier("block/carpet"))); provider.addTemplateModel(Templates.id("cube_special"), new UnbakedAutoRetexturedModel(new Identifier("block/cube"))); provider.addTemplateModel(Templates.id("fence_post_special"), new UnbakedAutoRetexturedModel(new Identifier("block/fence_post"))); - provider.addTemplateModel(Templates.id("fence_side_special"), new UnbakedAutoRetexturedModel(new Identifier("block/fence_side"))); provider.addTemplateModel(Templates.id("fence_gate_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_fence_gate"))); provider.addTemplateModel(Templates.id("fence_gate_open_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_fence_gate_open"))); provider.addTemplateModel(Templates.id("fence_gate_wall_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_fence_gate_wall"))); provider.addTemplateModel(Templates.id("fence_gate_wall_open_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_fence_gate_wall_open"))); provider.addTemplateModel(Templates.id("glass_pane_post_special"), new UnbakedAutoRetexturedModel(new Identifier("block/glass_pane_post"))); - provider.addTemplateModel(Templates.id("glass_pane_side_special"), new UnbakedAutoRetexturedModel(new Identifier("block/glass_pane_side"))); - provider.addTemplateModel(Templates.id("glass_pane_side_alt_special"), new UnbakedAutoRetexturedModel(new Identifier("block/glass_pane_side_alt"))); provider.addTemplateModel(Templates.id("glass_pane_noside_special"), new UnbakedAutoRetexturedModel(new Identifier("block/glass_pane_noside"))); provider.addTemplateModel(Templates.id("glass_pane_noside_alt_special"), new UnbakedAutoRetexturedModel(new Identifier("block/glass_pane_noside_alt"))); provider.addTemplateModel(Templates.id("pressure_plate_up_special"), new UnbakedAutoRetexturedModel(new Identifier("block/pressure_plate_up"))); @@ -88,13 +85,17 @@ public class TemplatesClient implements ClientModInitializer { provider.addTemplateModel(Templates.id("trapdoor_bottom_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_trapdoor_bottom"))); provider.addTemplateModel(Templates.id("trapdoor_top_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_trapdoor_top"))); provider.addTemplateModel(Templates.id("wall_post_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_wall_post"))); - provider.addTemplateModel(Templates.id("wall_side_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_wall_side"))); - provider.addTemplateModel(Templates.id("wall_side_tall_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_wall_side_tall"))); //vanilla style models (using "special-sprite replacement" method) provider.addTemplateModel(Templates.id("lever_special"), new UnbakedJsonRetexturedModel(Templates.id("block/lever"))); provider.addTemplateModel(Templates.id("trapdoor_open_special"), new UnbakedJsonRetexturedModel(Templates.id("block/trapdoor_open"))); provider.addTemplateModel(Templates.id("lever_on_special"), new UnbakedJsonRetexturedModel(Templates.id("block/lever_on"))); + //these only exist because AutoRetexturedModels don't seem to rotate their textures the right way when rotated from a multipart blockstate + provider.addTemplateModel(Templates.id("fence_side_special"), new UnbakedJsonRetexturedModel(Templates.id("block/fence_side"))); + provider.addTemplateModel(Templates.id("glass_pane_side_special"), new UnbakedJsonRetexturedModel(Templates.id("block/glass_pane_side"))); + provider.addTemplateModel(Templates.id("glass_pane_side_alt_special"), new UnbakedAutoRetexturedModel(Templates.id("block/glass_pane_side_alt"))); + provider.addTemplateModel(Templates.id("wall_side_special"), new UnbakedJsonRetexturedModel(Templates.id("block/wall_side"))); + provider.addTemplateModel(Templates.id("wall_side_tall_special"), new UnbakedJsonRetexturedModel(Templates.id("block/wall_side_tall"))); //mesh models provider.addTemplateModel(Templates.id("slope_special"), new UnbakedMeshRetexturedModel(Templates.id("block/slope_base"), SlopeBaseMesh::makeUpright)); diff --git a/src/main/resources/assets/templates/models/block/fence_side.json b/src/main/resources/assets/templates/models/block/fence_side.json new file mode 100644 index 0000000..9d76779 --- /dev/null +++ b/src/main/resources/assets/templates/models/block/fence_side.json @@ -0,0 +1,68 @@ +{ + "textures": { + "down": "templates:templates_special/down", + "up": "templates:templates_special/up", + "north": "templates:templates_special/north", + "south": "templates:templates_special/south", + "west": "templates:templates_special/west", + "east": "templates:templates_special/east" + }, + "elements": [ + { + "from": [7, 12, 0], + "to": [9, 15, 9], + "faces": { + "down": { + "uv": [7, 0, 9, 9], + "texture": "#down" + }, + "up": { + "uv": [7, 0, 9, 9], + "texture": "#up" + }, + "north": { + "uv": [7, 1, 9, 4], + "texture": "#north", + "cullface": "north" + }, + "west": { + "uv": [0, 1, 9, 4], + "texture": "#west" + }, + "east": { + "uv": [0, 1, 9, 4], + "texture": "#east" + } + }, + "__comment": "top bar" + }, + { + "from": [7, 6, 0], + "to": [9, 9, 9], + "faces": { + "down": { + "uv": [7, 0, 9, 9], + "texture": "#down" + }, + "up": { + "uv": [7, 0, 9, 9], + "texture": "#up" + }, + "north": { + "uv": [7, 7, 9, 10], + "texture": "#north", + "cullface": "north" + }, + "west": { + "uv": [0, 7, 9, 10], + "texture": "#west" + }, + "east": { + "uv": [0, 7, 9, 10], + "texture": "#east" + } + }, + "__comment": "lower bar" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/templates/models/block/glass_pane_side.json b/src/main/resources/assets/templates/models/block/glass_pane_side.json new file mode 100644 index 0000000..34b0926 --- /dev/null +++ b/src/main/resources/assets/templates/models/block/glass_pane_side.json @@ -0,0 +1,40 @@ +{ + "ambientocclusion": false, + "textures": { + "down": "templates:templates_special/down", + "up": "templates:templates_special/up", + "north": "templates:templates_special/north", + "south": "templates:templates_special/south", + "west": "templates:templates_special/west", + "east": "templates:templates_special/east" + }, + "elements": [ + { + "from": [7, 0, 0], + "to": [9, 16, 7], + "faces": { + "down": { + "uv": [7, 0, 9, 7], + "texture": "#down" + }, + "up": { + "uv": [7, 0, 9, 7], + "texture": "#up" + }, + "north": { + "uv": [7, 0, 9, 16], + "texture": "#north", + "cullface": "north" + }, + "west": { + "uv": [16, 0, 9, 16], + "texture": "#west" + }, + "east": { + "uv": [9, 0, 16, 16], + "texture": "#east" + } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/templates/models/block/glass_pane_side_alt.json b/src/main/resources/assets/templates/models/block/glass_pane_side_alt.json new file mode 100644 index 0000000..ed1337b --- /dev/null +++ b/src/main/resources/assets/templates/models/block/glass_pane_side_alt.json @@ -0,0 +1,40 @@ +{ + "ambientocclusion": false, + "textures": { + "down": "templates:templates_special/down", + "up": "templates:templates_special/up", + "north": "templates:templates_special/north", + "south": "templates:templates_special/south", + "west": "templates:templates_special/west", + "east": "templates:templates_special/east" + }, + "elements": [ + { + "from": [7, 0, 9], + "to": [9, 16, 16], + "faces": { + "down": { + "uv": [7, 0, 9, 7], + "texture": "#down" + }, + "up": { + "uv": [7, 0, 9, 7], + "texture": "#up" + }, + "south": { + "uv": [7, 0, 9, 16], + "texture": "#south", + "cullface": "south" + }, + "west": { + "uv": [7, 0, 0, 16], + "texture": "#west" + }, + "east": { + "uv": [0, 0, 7, 16], + "texture": "#east" + } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/templates/models/block/wall_side.json b/src/main/resources/assets/templates/models/block/wall_side.json new file mode 100644 index 0000000..b54d85d --- /dev/null +++ b/src/main/resources/assets/templates/models/block/wall_side.json @@ -0,0 +1,36 @@ +{ + "textures": { + "down": "templates:templates_special/down", + "up": "templates:templates_special/up", + "north": "templates:templates_special/north", + "south": "templates:templates_special/south", + "west": "templates:templates_special/west", + "east": "templates:templates_special/east" + }, + "elements": [ + { + "from": [5, 0, 0], + "to": [11, 14, 8], + "faces": { + "down": { + "texture": "#down", + "cullface": "down" + }, + "up": { + "texture": "#up" + }, + "north": { + "texture": "#north", + "cullface": "north" + }, + "west": { + "texture": "#west" + }, + "east": { + "texture": "#east" + } + }, + "__comment": "wall" + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/templates/models/block/wall_side_tall.json b/src/main/resources/assets/templates/models/block/wall_side_tall.json new file mode 100644 index 0000000..e9b63b1 --- /dev/null +++ b/src/main/resources/assets/templates/models/block/wall_side_tall.json @@ -0,0 +1,36 @@ +{ + "textures": { + "down": "templates:templates_special/down", + "up": "templates:templates_special/up", + "north": "templates:templates_special/north", + "south": "templates:templates_special/south", + "west": "templates:templates_special/west", + "east": "templates:templates_special/east" + }, + "elements": [ + { + "from": [5, 0, 0], + "to": [11, 16, 8], + "faces": { + "down": { + "texture": "#down", + "cullface": "down" + }, + "up": { + "texture": "#up", + "cullface": "up" + }, + "north": { + "texture": "#north", + "cullface": "north" + }, + "west": { + "texture": "#west" + }, + "east": { + "texture": "#east" + } + } + } + ] +} \ No newline at end of file