diff --git a/build.gradle b/build.gradle index 8c11a3ad7..fedbebbf4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false + id "dev.architectury.loom" version "1.9-SNAPSHOT" apply false id "io.github.juuxel.loom-quiltflower" version "1.+" apply false // Quiltflower, a better decompiler id "io.github.p03w.machete" version "1.+" // automatic jar compressing on build } diff --git a/common/src/generated/resources/assets/createdeco/blockstates/andesite_catwalk.json b/common/src/generated/resources/assets/createdeco/blockstates/andesite_catwalk.json index 6acbcbd32..ff4dc4b41 100644 --- a/common/src/generated/resources/assets/createdeco/blockstates/andesite_catwalk.json +++ b/common/src/generated/resources/assets/createdeco/blockstates/andesite_catwalk.json @@ -3,6 +3,52 @@ { "apply": { "model": "createdeco:block/andesite_catwalk" + }, + "when": { + "catwalk_top": "true" + } + }, + { + "apply": { + "model": "createdeco:block/andesite_catwalk_down" + }, + "when": { + "catwalk_bottom": "true" + } + }, + { + "apply": { + "model": "createdeco:block/andesite_catwalk_railing", + "y": 90 + }, + "when": { + "railing_north": "true" + } + }, + { + "apply": { + "model": "createdeco:block/andesite_catwalk_railing", + "y": 180 + }, + "when": { + "railing_east": "true" + } + }, + { + "apply": { + "model": "createdeco:block/andesite_catwalk_railing", + "y": 270 + }, + "when": { + "railing_south": "true" + } + }, + { + "apply": { + "model": "createdeco:block/andesite_catwalk_railing" + }, + "when": { + "railing_west": "true" } }, { diff --git a/common/src/generated/resources/assets/createdeco/blockstates/brass_catwalk.json b/common/src/generated/resources/assets/createdeco/blockstates/brass_catwalk.json index 2fde5e403..c9736975e 100644 --- a/common/src/generated/resources/assets/createdeco/blockstates/brass_catwalk.json +++ b/common/src/generated/resources/assets/createdeco/blockstates/brass_catwalk.json @@ -3,6 +3,52 @@ { "apply": { "model": "createdeco:block/brass_catwalk" + }, + "when": { + "catwalk_top": "true" + } + }, + { + "apply": { + "model": "createdeco:block/brass_catwalk_down" + }, + "when": { + "catwalk_bottom": "true" + } + }, + { + "apply": { + "model": "createdeco:block/brass_catwalk_railing", + "y": 90 + }, + "when": { + "railing_north": "true" + } + }, + { + "apply": { + "model": "createdeco:block/brass_catwalk_railing", + "y": 180 + }, + "when": { + "railing_east": "true" + } + }, + { + "apply": { + "model": "createdeco:block/brass_catwalk_railing", + "y": 270 + }, + "when": { + "railing_south": "true" + } + }, + { + "apply": { + "model": "createdeco:block/brass_catwalk_railing" + }, + "when": { + "railing_west": "true" } }, { diff --git a/common/src/generated/resources/assets/createdeco/blockstates/copper_catwalk.json b/common/src/generated/resources/assets/createdeco/blockstates/copper_catwalk.json index 356df52d3..69aa3773f 100644 --- a/common/src/generated/resources/assets/createdeco/blockstates/copper_catwalk.json +++ b/common/src/generated/resources/assets/createdeco/blockstates/copper_catwalk.json @@ -3,6 +3,52 @@ { "apply": { "model": "createdeco:block/copper_catwalk" + }, + "when": { + "catwalk_top": "true" + } + }, + { + "apply": { + "model": "createdeco:block/copper_catwalk_down" + }, + "when": { + "catwalk_bottom": "true" + } + }, + { + "apply": { + "model": "createdeco:block/copper_catwalk_railing", + "y": 90 + }, + "when": { + "railing_north": "true" + } + }, + { + "apply": { + "model": "createdeco:block/copper_catwalk_railing", + "y": 180 + }, + "when": { + "railing_east": "true" + } + }, + { + "apply": { + "model": "createdeco:block/copper_catwalk_railing", + "y": 270 + }, + "when": { + "railing_south": "true" + } + }, + { + "apply": { + "model": "createdeco:block/copper_catwalk_railing" + }, + "when": { + "railing_west": "true" } }, { diff --git a/common/src/generated/resources/assets/createdeco/blockstates/industrial_iron_catwalk.json b/common/src/generated/resources/assets/createdeco/blockstates/industrial_iron_catwalk.json index e8b28e831..956d6f3b9 100644 --- a/common/src/generated/resources/assets/createdeco/blockstates/industrial_iron_catwalk.json +++ b/common/src/generated/resources/assets/createdeco/blockstates/industrial_iron_catwalk.json @@ -3,6 +3,52 @@ { "apply": { "model": "createdeco:block/industrial_iron_catwalk" + }, + "when": { + "catwalk_top": "true" + } + }, + { + "apply": { + "model": "createdeco:block/industrial_iron_catwalk_down" + }, + "when": { + "catwalk_bottom": "true" + } + }, + { + "apply": { + "model": "createdeco:block/industrial_iron_catwalk_railing", + "y": 90 + }, + "when": { + "railing_north": "true" + } + }, + { + "apply": { + "model": "createdeco:block/industrial_iron_catwalk_railing", + "y": 180 + }, + "when": { + "railing_east": "true" + } + }, + { + "apply": { + "model": "createdeco:block/industrial_iron_catwalk_railing", + "y": 270 + }, + "when": { + "railing_south": "true" + } + }, + { + "apply": { + "model": "createdeco:block/industrial_iron_catwalk_railing" + }, + "when": { + "railing_west": "true" } }, { diff --git a/common/src/generated/resources/assets/createdeco/blockstates/iron_catwalk.json b/common/src/generated/resources/assets/createdeco/blockstates/iron_catwalk.json index 7b8f26f1e..df5995e02 100644 --- a/common/src/generated/resources/assets/createdeco/blockstates/iron_catwalk.json +++ b/common/src/generated/resources/assets/createdeco/blockstates/iron_catwalk.json @@ -3,6 +3,52 @@ { "apply": { "model": "createdeco:block/iron_catwalk" + }, + "when": { + "catwalk_top": "true" + } + }, + { + "apply": { + "model": "createdeco:block/iron_catwalk_down" + }, + "when": { + "catwalk_bottom": "true" + } + }, + { + "apply": { + "model": "createdeco:block/iron_catwalk_railing", + "y": 90 + }, + "when": { + "railing_north": "true" + } + }, + { + "apply": { + "model": "createdeco:block/iron_catwalk_railing", + "y": 180 + }, + "when": { + "railing_east": "true" + } + }, + { + "apply": { + "model": "createdeco:block/iron_catwalk_railing", + "y": 270 + }, + "when": { + "railing_south": "true" + } + }, + { + "apply": { + "model": "createdeco:block/iron_catwalk_railing" + }, + "when": { + "railing_west": "true" } }, { diff --git a/common/src/generated/resources/assets/createdeco/blockstates/zinc_catwalk.json b/common/src/generated/resources/assets/createdeco/blockstates/zinc_catwalk.json index a9abf5980..cd4c9d0eb 100644 --- a/common/src/generated/resources/assets/createdeco/blockstates/zinc_catwalk.json +++ b/common/src/generated/resources/assets/createdeco/blockstates/zinc_catwalk.json @@ -3,6 +3,52 @@ { "apply": { "model": "createdeco:block/zinc_catwalk" + }, + "when": { + "catwalk_top": "true" + } + }, + { + "apply": { + "model": "createdeco:block/zinc_catwalk_down" + }, + "when": { + "catwalk_bottom": "true" + } + }, + { + "apply": { + "model": "createdeco:block/zinc_catwalk_railing", + "y": 90 + }, + "when": { + "railing_north": "true" + } + }, + { + "apply": { + "model": "createdeco:block/zinc_catwalk_railing", + "y": 180 + }, + "when": { + "railing_east": "true" + } + }, + { + "apply": { + "model": "createdeco:block/zinc_catwalk_railing", + "y": 270 + }, + "when": { + "railing_south": "true" + } + }, + { + "apply": { + "model": "createdeco:block/zinc_catwalk_railing" + }, + "when": { + "railing_west": "true" } }, { diff --git a/common/src/generated/resources/assets/createdeco/models/block/andesite_catwalk_down.json b/common/src/generated/resources/assets/createdeco/models/block/andesite_catwalk_down.json new file mode 100644 index 000000000..60a99d33c --- /dev/null +++ b/common/src/generated/resources/assets/createdeco/models/block/andesite_catwalk_down.json @@ -0,0 +1,7 @@ +{ + "parent": "createdeco:block/catwalk_bottom", + "textures": { + "2": "createdeco:block/palettes/catwalks/andesite_catwalk", + "particle": "createdeco:block/palettes/catwalks/andesite_catwalk" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/createdeco/models/block/brass_catwalk_down.json b/common/src/generated/resources/assets/createdeco/models/block/brass_catwalk_down.json new file mode 100644 index 000000000..014a29973 --- /dev/null +++ b/common/src/generated/resources/assets/createdeco/models/block/brass_catwalk_down.json @@ -0,0 +1,7 @@ +{ + "parent": "createdeco:block/catwalk_bottom", + "textures": { + "2": "createdeco:block/palettes/catwalks/brass_catwalk", + "particle": "createdeco:block/palettes/catwalks/brass_catwalk" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/createdeco/models/block/copper_catwalk_down.json b/common/src/generated/resources/assets/createdeco/models/block/copper_catwalk_down.json new file mode 100644 index 000000000..b12b5bd05 --- /dev/null +++ b/common/src/generated/resources/assets/createdeco/models/block/copper_catwalk_down.json @@ -0,0 +1,7 @@ +{ + "parent": "createdeco:block/catwalk_bottom", + "textures": { + "2": "createdeco:block/palettes/catwalks/copper_catwalk", + "particle": "createdeco:block/palettes/catwalks/copper_catwalk" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/createdeco/models/block/industrial_iron_catwalk_down.json b/common/src/generated/resources/assets/createdeco/models/block/industrial_iron_catwalk_down.json new file mode 100644 index 000000000..ce84e7546 --- /dev/null +++ b/common/src/generated/resources/assets/createdeco/models/block/industrial_iron_catwalk_down.json @@ -0,0 +1,7 @@ +{ + "parent": "createdeco:block/catwalk_bottom", + "textures": { + "2": "createdeco:block/palettes/catwalks/industrial_iron_catwalk", + "particle": "createdeco:block/palettes/catwalks/industrial_iron_catwalk" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/createdeco/models/block/iron_catwalk_down.json b/common/src/generated/resources/assets/createdeco/models/block/iron_catwalk_down.json new file mode 100644 index 000000000..ba2a6136c --- /dev/null +++ b/common/src/generated/resources/assets/createdeco/models/block/iron_catwalk_down.json @@ -0,0 +1,7 @@ +{ + "parent": "createdeco:block/catwalk_bottom", + "textures": { + "2": "createdeco:block/palettes/catwalks/iron_catwalk", + "particle": "createdeco:block/palettes/catwalks/iron_catwalk" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/assets/createdeco/models/block/zinc_catwalk_down.json b/common/src/generated/resources/assets/createdeco/models/block/zinc_catwalk_down.json new file mode 100644 index 000000000..f12cbd12b --- /dev/null +++ b/common/src/generated/resources/assets/createdeco/models/block/zinc_catwalk_down.json @@ -0,0 +1,7 @@ +{ + "parent": "createdeco:block/catwalk_bottom", + "textures": { + "2": "createdeco:block/palettes/catwalks/zinc_catwalk", + "particle": "createdeco:block/palettes/catwalks/zinc_catwalk" + } +} \ No newline at end of file diff --git a/common/src/generated/resources/data/createdeco/loot_tables/blocks/andesite_catwalk.json b/common/src/generated/resources/data/createdeco/loot_tables/blocks/andesite_catwalk.json index 2302d9fd5..528b6506e 100644 --- a/common/src/generated/resources/data/createdeco/loot_tables/blocks/andesite_catwalk.json +++ b/common/src/generated/resources/data/createdeco/loot_tables/blocks/andesite_catwalk.json @@ -3,6 +3,41 @@ "pools": [ { "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:andesite_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_top": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:andesite_catwalk" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:andesite_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_bottom": "true" + } + } + ], "entries": [ { "type": "minecraft:item", @@ -20,7 +55,106 @@ }, { "bonus_rolls": 0.0, - "entries": [], + "conditions": [ + { + "block": "createdeco:andesite_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_north": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:andesite_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:andesite_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_south": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:andesite_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:andesite_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_west": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:andesite_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:andesite_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_east": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:andesite_catwalk_railing" + } + ], "rolls": 1.0 } ], diff --git a/common/src/generated/resources/data/createdeco/loot_tables/blocks/brass_catwalk.json b/common/src/generated/resources/data/createdeco/loot_tables/blocks/brass_catwalk.json index 1f6d66a6a..f5f3512f7 100644 --- a/common/src/generated/resources/data/createdeco/loot_tables/blocks/brass_catwalk.json +++ b/common/src/generated/resources/data/createdeco/loot_tables/blocks/brass_catwalk.json @@ -3,6 +3,41 @@ "pools": [ { "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:brass_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_top": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:brass_catwalk" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:brass_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_bottom": "true" + } + } + ], "entries": [ { "type": "minecraft:item", @@ -20,7 +55,106 @@ }, { "bonus_rolls": 0.0, - "entries": [], + "conditions": [ + { + "block": "createdeco:brass_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_north": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:brass_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:brass_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_south": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:brass_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:brass_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_west": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:brass_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:brass_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_east": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:brass_catwalk_railing" + } + ], "rolls": 1.0 } ], diff --git a/common/src/generated/resources/data/createdeco/loot_tables/blocks/copper_catwalk.json b/common/src/generated/resources/data/createdeco/loot_tables/blocks/copper_catwalk.json index 53c679eb4..df6880ace 100644 --- a/common/src/generated/resources/data/createdeco/loot_tables/blocks/copper_catwalk.json +++ b/common/src/generated/resources/data/createdeco/loot_tables/blocks/copper_catwalk.json @@ -3,6 +3,41 @@ "pools": [ { "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:copper_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_top": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:copper_catwalk" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:copper_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_bottom": "true" + } + } + ], "entries": [ { "type": "minecraft:item", @@ -20,7 +55,106 @@ }, { "bonus_rolls": 0.0, - "entries": [], + "conditions": [ + { + "block": "createdeco:copper_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_north": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:copper_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:copper_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_south": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:copper_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:copper_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_west": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:copper_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:copper_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_east": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:copper_catwalk_railing" + } + ], "rolls": 1.0 } ], diff --git a/common/src/generated/resources/data/createdeco/loot_tables/blocks/industrial_iron_catwalk.json b/common/src/generated/resources/data/createdeco/loot_tables/blocks/industrial_iron_catwalk.json index 299c943c9..3d1f8371e 100644 --- a/common/src/generated/resources/data/createdeco/loot_tables/blocks/industrial_iron_catwalk.json +++ b/common/src/generated/resources/data/createdeco/loot_tables/blocks/industrial_iron_catwalk.json @@ -3,6 +3,41 @@ "pools": [ { "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:industrial_iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_top": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:industrial_iron_catwalk" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:industrial_iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_bottom": "true" + } + } + ], "entries": [ { "type": "minecraft:item", @@ -20,7 +55,106 @@ }, { "bonus_rolls": 0.0, - "entries": [], + "conditions": [ + { + "block": "createdeco:industrial_iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_north": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:industrial_iron_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:industrial_iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_south": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:industrial_iron_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:industrial_iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_west": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:industrial_iron_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:industrial_iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_east": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:industrial_iron_catwalk_railing" + } + ], "rolls": 1.0 } ], diff --git a/common/src/generated/resources/data/createdeco/loot_tables/blocks/iron_catwalk.json b/common/src/generated/resources/data/createdeco/loot_tables/blocks/iron_catwalk.json index 76fc62f64..568c2f5c7 100644 --- a/common/src/generated/resources/data/createdeco/loot_tables/blocks/iron_catwalk.json +++ b/common/src/generated/resources/data/createdeco/loot_tables/blocks/iron_catwalk.json @@ -3,6 +3,41 @@ "pools": [ { "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_top": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:iron_catwalk" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_bottom": "true" + } + } + ], "entries": [ { "type": "minecraft:item", @@ -20,7 +55,106 @@ }, { "bonus_rolls": 0.0, - "entries": [], + "conditions": [ + { + "block": "createdeco:iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_north": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:iron_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_south": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:iron_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_west": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:iron_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:iron_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_east": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:iron_catwalk_railing" + } + ], "rolls": 1.0 } ], diff --git a/common/src/generated/resources/data/createdeco/loot_tables/blocks/zinc_catwalk.json b/common/src/generated/resources/data/createdeco/loot_tables/blocks/zinc_catwalk.json index 479ab35f0..e2e01a9fc 100644 --- a/common/src/generated/resources/data/createdeco/loot_tables/blocks/zinc_catwalk.json +++ b/common/src/generated/resources/data/createdeco/loot_tables/blocks/zinc_catwalk.json @@ -3,6 +3,41 @@ "pools": [ { "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:zinc_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_top": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:zinc_catwalk" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:zinc_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "catwalk_bottom": "true" + } + } + ], "entries": [ { "type": "minecraft:item", @@ -20,7 +55,106 @@ }, { "bonus_rolls": 0.0, - "entries": [], + "conditions": [ + { + "block": "createdeco:zinc_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_north": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:zinc_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:zinc_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_south": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:zinc_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:zinc_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_west": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:zinc_catwalk_railing" + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "block": "createdeco:zinc_catwalk", + "condition": "minecraft:block_state_property", + "properties": { + "railing_east": "true" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "add": false, + "count": 1.0, + "function": "minecraft:set_count" + } + ], + "name": "createdeco:zinc_catwalk_railing" + } + ], "rolls": 1.0 } ], diff --git a/common/src/main/java/com/github/talrey/createdeco/api/Catwalks.java b/common/src/main/java/com/github/talrey/createdeco/api/Catwalks.java index 8104ebec7..4f9243f5a 100644 --- a/common/src/main/java/com/github/talrey/createdeco/api/Catwalks.java +++ b/common/src/main/java/com/github/talrey/createdeco/api/Catwalks.java @@ -45,7 +45,9 @@ public class Catwalks { public static BlockBuilder build ( CreateRegistrate reg, String metal ) { - return reg.block(metal.toLowerCase(Locale.ROOT).replaceAll(" ", "_") + "_catwalk", CatwalkBlock::new) + return reg.block(metal.toLowerCase(Locale.ROOT). + replaceAll(" ", "_") + "_catwalk", + p -> new CatwalkBlock(p, metal)) .properties(props-> props.strength(5, 6).requiresCorrectToolForDrops().noOcclusion() .sound(SoundType.NETHERITE_BLOCK) @@ -53,13 +55,45 @@ public static BlockBuilder build ( .loot((table, block) -> { LootTable.Builder builder = LootTable.lootTable(); - LootPool.Builder catwalksPool = LootPool.lootPool().setRolls(ConstantValue.exactly(1)); - LootPool.Builder supportPool = LootPool.lootPool().setRolls(ConstantValue.exactly(1)); - LootItem.Builder catwalks = LootItem.lootTableItem(block); - catwalks.apply(SetItemCountFunction.setCount(ConstantValue.exactly(1))); - catwalksPool.add(catwalks); - table.add(block, builder.withPool(catwalksPool).withPool(supportPool)); + builder.withPool( + LootPool.lootPool() + .setRolls(ConstantValue.exactly(1.0F)) + .when(LootItemBlockStatePropertyCondition + .hasBlockStateProperties(block) + .setProperties( + StatePropertiesPredicate.Builder.properties() + .hasProperty(CatwalkBlock.CATWALK_TOP, true))) + .add(LootItem.lootTableItem(block).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1)))) + ); + + builder.withPool( + LootPool.lootPool() + .setRolls(ConstantValue.exactly(1.0F)) + .when(LootItemBlockStatePropertyCondition + .hasBlockStateProperties(block) + .setProperties( + StatePropertiesPredicate.Builder.properties() + .hasProperty(CatwalkBlock.CATWALK_BOTTOM, true))) + .add(LootItem.lootTableItem(block).apply(SetItemCountFunction.setCount(ConstantValue.exactly(1)))) + ); + + for (Direction dir : BlockStateProperties.HORIZONTAL_FACING.getPossibleValues()) { + builder.withPool( + LootPool.lootPool() + .setRolls(ConstantValue.exactly(1.0F)) + .when(LootItemBlockStatePropertyCondition + .hasBlockStateProperties(block) + .setProperties( + StatePropertiesPredicate.Builder.properties() + .hasProperty(CatwalkBlock.fromDirection(dir), true))) + .add( + LootItem.lootTableItem(BlockRegistry.CATWALK_RAILINGS.get(metal)) + .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1)))) + ); + } + + table.add(block, builder); }) .addLayer(() -> RenderType::cutoutMipped) .tag(BlockTags.MINEABLE_WITH_PICKAXE) @@ -128,7 +162,10 @@ public static BlockBuilder buildRailing ( ) { String regName = metal.toLowerCase(Locale.ROOT).replaceAll(" ", "_"); String texture = reg.getModid() + ":block/palettes/catwalks/" + regName + "_catwalk"; - return reg.block(metal.toLowerCase(Locale.ROOT).replaceAll(" ", "_") + "_catwalk_railing", CatwalkRailingBlock::new) + return reg.block( + metal.toLowerCase(Locale.ROOT).replaceAll(" ", "_") + "_catwalk_railing", + p -> new CatwalkRailingBlock(p, metal) + ) .properties(props-> props.strength(5, 6) .requiresCorrectToolForDrops().noOcclusion().sound(SoundType.NETHERITE_BLOCK) diff --git a/common/src/main/java/com/github/talrey/createdeco/blocks/CatwalkBlock.java b/common/src/main/java/com/github/talrey/createdeco/blocks/CatwalkBlock.java index 496efd22a..d1f0a6e94 100644 --- a/common/src/main/java/com/github/talrey/createdeco/blocks/CatwalkBlock.java +++ b/common/src/main/java/com/github/talrey/createdeco/blocks/CatwalkBlock.java @@ -1,42 +1,115 @@ package com.github.talrey.createdeco.blocks; +import com.github.talrey.createdeco.BlockRegistry; +import com.github.talrey.createdeco.ItemRegistry; import com.simibubi.create.content.equipment.wrench.IWrenchable; import com.simibubi.create.foundation.block.ProperWaterloggedBlock; +import com.simibubi.create.api.schematic.requirement.SpecialBlockItemRequirement; +import com.simibubi.create.content.schematics.requirement.ItemRequirement; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.network.chat.Component; +import java.util.HashMap; +import java.util.ArrayList; +import java.util.Map; +import java.util.Optional; -public class CatwalkBlock extends Block implements IWrenchable, ProperWaterloggedBlock { - private static final VoxelShape VOXEL_TOP = Block.box( +public class CatwalkBlock extends Block implements IWrenchable, ProperWaterloggedBlock, SpecialBlockItemRequirement { + private static final VoxelShape VOXEL_CATWALK_TOP = Block.box( 0d, 14d, 0d, 16d, 16d, 16d ); + private static final VoxelShape VOXEL_CATWALK_BOTTOM = Block.box( + 0d, 0d, 0d, + 16d, 2d, 16d + ); + private static final VoxelShape VOXEL_RAILING_NORTH = Block.box( + 0d, 0d, 0d, + 16d, 14d, 2d + ); + private static final VoxelShape VOXEL_RAILING_SOUTH = Block.box( + 0d, 0d, 14d, + 16d, 14d, 16d + ); + private static final VoxelShape VOXEL_RAILING_EAST = Block.box( + 14d, 0d, 0d, + 16d, 14d, 16d + ); + private static final VoxelShape VOXEL_RAILING_WEST = Block.box( + 0d, 0d, 0d, + 2d, 14d, 16d + ); + private static final VoxelShape SUPPORTED = Shapes.block(); + // This property indicates whether there's a support block under it. public static final BooleanProperty BOTTOM = BlockStateProperties.BOTTOM; - public CatwalkBlock (Properties props) { + // Properties to indicate whether there's a catwalk on the top or bottom + public static final BooleanProperty CATWALK_TOP = BooleanProperty.create("catwalk_top"); + public static final BooleanProperty CATWALK_BOTTOM = BooleanProperty.create("catwalk_bottom"); + // Properties to indicate the presence of railings on any of the four sides + public static final BooleanProperty RAILING_NORTH = BooleanProperty.create("railing_north"); + public static final BooleanProperty RAILING_SOUTH = BooleanProperty.create("railing_south"); + public static final BooleanProperty RAILING_EAST = BooleanProperty.create("railing_east"); + public static final BooleanProperty RAILING_WEST = BooleanProperty.create("railing_west"); + + private static final HashMap SHAPE_PROPERTY_MAPPING = new HashMap(); + + static { + SHAPE_PROPERTY_MAPPING.put(VOXEL_CATWALK_TOP, CATWALK_TOP); + SHAPE_PROPERTY_MAPPING.put(VOXEL_CATWALK_BOTTOM, CATWALK_BOTTOM); + SHAPE_PROPERTY_MAPPING.put(VOXEL_RAILING_NORTH, RAILING_NORTH); + SHAPE_PROPERTY_MAPPING.put(VOXEL_RAILING_SOUTH, RAILING_SOUTH); + SHAPE_PROPERTY_MAPPING.put(VOXEL_RAILING_EAST, RAILING_EAST); + SHAPE_PROPERTY_MAPPING.put(VOXEL_RAILING_WEST, RAILING_WEST); + } + + // A string indicating the material of this block. This is used in + // interactions between the catwalk block and catwalk items and railing items. + // Only items of the same material can be combined together. + public final String metal; + + public CatwalkBlock (Properties props, String metal) { super(props); + this.metal = metal; this.registerDefaultState(this.defaultBlockState() .setValue(BOTTOM, false) - .setValue(WATERLOGGED, false)); + .setValue(WATERLOGGED, false) + .setValue(CATWALK_TOP, true) + .setValue(CATWALK_BOTTOM, false) + .setValue(RAILING_NORTH, false) + .setValue(RAILING_SOUTH, false) + .setValue(RAILING_EAST, false) + .setValue(RAILING_WEST, false) + ); } @Override @@ -46,12 +119,107 @@ public VoxelShape getShape(BlockState state, BlockGetter reader, BlockPos pos, C @Override public VoxelShape getInteractionShape (BlockState state, BlockGetter world, BlockPos pos) { - return state.getValue(BOTTOM) ? SUPPORTED : VOXEL_TOP; + VoxelShape shape = Shapes.empty(); + if (state.getValue(BOTTOM)) + shape = Shapes.join(shape, SUPPORTED, BooleanOp.OR); + + if (state.getValue(CATWALK_TOP)) + shape = Shapes.join(shape, VOXEL_CATWALK_TOP, BooleanOp.OR); + if (state.getValue(CATWALK_BOTTOM)) + shape = Shapes.join(shape, VOXEL_CATWALK_BOTTOM, BooleanOp.OR); + + if (state.getValue(RAILING_NORTH)) + shape = Shapes.join(shape, VOXEL_RAILING_NORTH, BooleanOp.OR); + if (state.getValue(RAILING_SOUTH)) + shape = Shapes.join(shape, VOXEL_RAILING_SOUTH, BooleanOp.OR); + if (state.getValue(RAILING_EAST)) + shape = Shapes.join(shape, VOXEL_RAILING_EAST, BooleanOp.OR); + if (state.getValue(RAILING_WEST)) + shape = Shapes.join(shape, VOXEL_RAILING_WEST, BooleanOp.OR); + + return shape; } + private Optional clickedShape(BlockState state, Vec3 subboxClickLocation) { + double min_distance = 1.0; + + Optional closestShape = Optional.empty(); + + for (Map.Entry entry: SHAPE_PROPERTY_MAPPING.entrySet()) { + VoxelShape shape = entry.getKey(); + BooleanProperty property = entry.getValue(); + + // Ignore shapes that are not enabled + if (!state.getValue(property)) continue; + + Optional point = shape.closestPointTo(subboxClickLocation); + if (point.isEmpty()) continue; + + double distance = point.get().distanceToSqr(subboxClickLocation); + if (distance < min_distance) { + closestShape = Optional.of(shape); + min_distance = distance; + } + } + + return closestShape; + } + + @Override + public InteractionResult onSneakWrenched (BlockState state, UseOnContext context) { + BlockPos pos = context.getClickedPos(); + Direction face = context.getClickedFace(); + Level level = context.getLevel(); + Player player = context.getPlayer(); + + // This position will initially be in [-0.5, 0.5]. + Vec3 subbox = context.getClickLocation().subtract(pos.getCenter()); + // We want to map that to a position in [0, 1] + subbox = subbox.add(0.5, 0.5, 0.5); + + if (level.isClientSide()) return InteractionResult.PASS; + + // Check which of the shapes was clicked + Optional clickedShapeOption = clickedShape(state, subbox); + + if (clickedShapeOption.isPresent()) { + VoxelShape clickedShape = clickedShapeOption.get(); + BooleanProperty property = SHAPE_PROPERTY_MAPPING.get(clickedShape); + // Set the property to false + state = state.setValue(property, false); + level.setBlock(pos, state, 3); + IWrenchable.playRemoveSound(level, pos); + if (!player.getAbilities().instabuild) { + // Return the corresponding item to the player + if (clickedShape == VOXEL_CATWALK_TOP || clickedShape == VOXEL_CATWALK_BOTTOM) { + player.addItem( + new ItemStack(BlockRegistry.CATWALKS.get(this.metal)) + ); + } else { + player.addItem( + new ItemStack(BlockRegistry.CATWALK_RAILINGS.get(this.metal)) + ); + } + } + // Check if we removed the last element of the block. + // In that case, clear the block + if (isEmpty(state)) { + level.setBlock(pos, Blocks.AIR.defaultBlockState(), 0); + } + + return InteractionResult.SUCCESS; + } else { + return InteractionResult.PASS; + } + } private boolean isBottom(BlockGetter level, BlockPos pos) { - return level.getBlockState(pos.below()).getBlock() instanceof SupportBlock; + return + ( + !(level.getBlockState(pos).getBlock() instanceof CatwalkBlock) + || level.getBlockState(pos).getValue(CATWALK_TOP) + ) && + level.getBlockState(pos.below()).getBlock() instanceof SupportBlock; } public static boolean isCatwalk (ItemStack test) { @@ -61,6 +229,10 @@ public static boolean isCatwalk (ItemStack test) { } public static boolean isCatwalk (Block test) { + return test instanceof CatwalkBlock; + } + + public static boolean isCatwalkOrStair (Block test) { return test instanceof CatwalkBlock || test instanceof CatwalkStairBlock; } @@ -83,6 +255,12 @@ public static boolean canPlaceCatwalk (Level world, BlockPos pos) { protected void createBlockStateDefinition (StateDefinition.Builder builder) { super.createBlockStateDefinition(builder); builder.add(BlockStateProperties.WATERLOGGED, BOTTOM); + builder.add(CATWALK_BOTTOM); + builder.add(CATWALK_TOP); + builder.add(RAILING_NORTH); + builder.add(RAILING_SOUTH); + builder.add(RAILING_EAST); + builder.add(RAILING_WEST); } @Override @@ -120,4 +298,173 @@ public BlockState updateShape(BlockState state, Direction direction, BlockState return state; } + + public static BooleanProperty fromDirection (Direction face) { + return switch (face) { + case SOUTH -> RAILING_SOUTH; + case EAST -> RAILING_EAST; + case WEST -> RAILING_WEST; + default -> RAILING_NORTH; + }; + } + + public static boolean hasAnyCatwalks(BlockState state) { + boolean hasAnyCatwalks = false; + + hasAnyCatwalks |= state.getValue(CATWALK_TOP); + hasAnyCatwalks |= state.getValue(CATWALK_BOTTOM); + + return hasAnyCatwalks; + } + + public static boolean hasAnyRailings(BlockState state) { + boolean hasAnyRailings = false; + + hasAnyRailings |= state.getValue(RAILING_NORTH); + hasAnyRailings |= state.getValue(RAILING_SOUTH); + hasAnyRailings |= state.getValue(RAILING_EAST); + hasAnyRailings |= state.getValue(RAILING_WEST); + + return hasAnyRailings; + } + + public static boolean isEmpty(BlockState state) { + boolean hasAnyElement = false; + + hasAnyElement |= hasAnyCatwalks(state); + hasAnyElement |= hasAnyRailings(state); + + return !hasAnyElement; + } + + /** + Wrenching a catwalk block behaves differently depending on the block state. + If the catwalk block doesn't have any railings, then wrenching it will + toggle the catwalk state between the top and bottom version. + + If it does have railings then we use the default implementation, which + rotates the block. + **/ + @Override + public InteractionResult onWrenched (BlockState state, UseOnContext context) { + BlockPos pos = context.getClickedPos(); + Level level = context.getLevel(); + + BlockState new_state; + + boolean hasAnyRailings = hasAnyRailings(state); + + if (!hasAnyRailings && state.getValue(CATWALK_TOP)) { + new_state = state + .setValue(CATWALK_TOP, false) + .setValue(CATWALK_BOTTOM, true); + } else if (!hasAnyRailings && state.getValue(CATWALK_BOTTOM)) { + new_state = state + .setValue(CATWALK_TOP, true) + .setValue(CATWALK_BOTTOM, false); + } else { + // Otherwise use the default interaction to rotate the block + return IWrenchable.super.onWrenched(state, context); + } + + level.setBlock(pos, new_state, 3); + return InteractionResult.SUCCESS; + } + + @Override + public BlockState getRotatedBlockState(BlockState originalState, Direction targetedFace) { + if (targetedFace.getAxis() == Direction.Axis.Y) { + int state = + (originalState.getValue(RAILING_NORTH) ? 8 : 0) + + (originalState.getValue(RAILING_EAST) ? 4 : 0) + + (originalState.getValue(RAILING_SOUTH) ? 2 : 0) + + (originalState.getValue(RAILING_WEST) ? 1 : 0); + return originalState + .setValue(RAILING_NORTH, (state & 1) == 1) + .setValue(RAILING_EAST, (state & 8) == 8) + .setValue(RAILING_SOUTH, (state & 4) == 4) + .setValue(RAILING_WEST, (state & 2) == 2); + } + return originalState; + } + + @Override + public BlockState rotate(BlockState state, Rotation rotation) { + // A bitmask that contains the state of the railings + int bits = + (state.getValue(RAILING_NORTH) ? 8 : 0) + + (state.getValue(RAILING_EAST) ? 4 : 0) + + (state.getValue(RAILING_SOUTH) ? 2 : 0) + + (state.getValue(RAILING_WEST) ? 1 : 0); + return switch (rotation) { + case CLOCKWISE_90 -> + state + .setValue(RAILING_NORTH, (bits & 1) == 1) + .setValue(RAILING_EAST, (bits & 8) == 8) + .setValue(RAILING_SOUTH, (bits & 4) == 4) + .setValue(RAILING_WEST, (bits & 2) == 2) + ; + case CLOCKWISE_180 -> + state + .setValue(RAILING_NORTH, (bits & 2) == 2) + .setValue(RAILING_EAST, (bits & 1) == 1) + .setValue(RAILING_SOUTH, (bits & 8) == 8) + .setValue(RAILING_WEST, (bits & 4) == 4) + ; + case COUNTERCLOCKWISE_90 -> + state + .setValue(RAILING_NORTH, (bits & 4) == 4) + .setValue(RAILING_EAST, (bits & 2) == 2) + .setValue(RAILING_SOUTH, (bits & 1) == 1) + .setValue(RAILING_WEST, (bits & 8) == 8) + ; + default -> state; + }; + } + + @Override + public BlockState mirror(BlockState state, Mirror mirror) { + // A bitmask that contains the state of the railings + int bits = + (state.getValue(RAILING_NORTH) ? 8 : 0) + + (state.getValue(RAILING_EAST) ? 4 : 0) + + (state.getValue(RAILING_SOUTH) ? 2 : 0) + + (state.getValue(RAILING_WEST) ? 1 : 0); + return switch (mirror) { + case LEFT_RIGHT -> + state + .setValue(RAILING_NORTH, (bits & 2) == 2) + .setValue(RAILING_SOUTH, (bits & 8) == 8) + ; + case FRONT_BACK -> + state + .setValue(RAILING_EAST, (bits & 1) == 1) + .setValue(RAILING_WEST, (bits & 4) == 4) + ; + default -> state; + }; + } + + @Override + public ItemRequirement getRequiredItems(BlockState state, BlockEntity blockEntity) { + ArrayList stacks = new ArrayList<>(); + + int catwalk_count = 0; + catwalk_count += state.getValue(CATWALK_TOP)? 1 : 0; + catwalk_count += state.getValue(CATWALK_BOTTOM)? 1 : 0; + stacks.add(new ItemStack(this.asItem(), catwalk_count)); + + int railing_count = 0; + railing_count += state.getValue(RAILING_NORTH)? 1 : 0; + railing_count += state.getValue(RAILING_EAST)? 1 : 0; + railing_count += state.getValue(RAILING_SOUTH)? 1 : 0; + railing_count += state.getValue(RAILING_WEST)? 1 : 0; + stacks.add(new ItemStack( + BlockRegistry.CATWALK_RAILINGS.get(this.metal).get().asItem(), + railing_count) + ); + + return new ItemRequirement(ItemRequirement.ItemUseType.CONSUME, stacks); + } + } diff --git a/common/src/main/java/com/github/talrey/createdeco/blocks/CatwalkRailingBlock.java b/common/src/main/java/com/github/talrey/createdeco/blocks/CatwalkRailingBlock.java index c2091080c..b5e5339b3 100644 --- a/common/src/main/java/com/github/talrey/createdeco/blocks/CatwalkRailingBlock.java +++ b/common/src/main/java/com/github/talrey/createdeco/blocks/CatwalkRailingBlock.java @@ -1,6 +1,8 @@ package com.github.talrey.createdeco.blocks; import com.simibubi.create.content.equipment.wrench.IWrenchable; +import com.simibubi.create.api.schematic.requirement.SpecialBlockItemRequirement; +import com.simibubi.create.content.schematics.requirement.ItemRequirement; import com.simibubi.create.foundation.block.ProperWaterloggedBlock; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -15,6 +17,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; @@ -29,7 +32,7 @@ import javax.annotation.Nullable; -public class CatwalkRailingBlock extends Block implements IWrenchable, ProperWaterloggedBlock { +public class CatwalkRailingBlock extends Block implements IWrenchable, ProperWaterloggedBlock, SpecialBlockItemRequirement { private static final VoxelShape VOXEL_NORTH = Block.box( 0d, 0d, 0d, 16d, 14d, 2d @@ -52,8 +55,11 @@ public class CatwalkRailingBlock extends Block implements IWrenchable, ProperWat public static final BooleanProperty EAST_FENCE = BlockStateProperties.EAST; public static final BooleanProperty WEST_FENCE = BlockStateProperties.WEST; - public CatwalkRailingBlock (Properties props) { + public final String metal; + + public CatwalkRailingBlock (Properties props, String metal) { super(props); + this.metal = metal; this.registerDefaultState(this.defaultBlockState() .setValue(NORTH_FENCE, false) .setValue(SOUTH_FENCE, false) @@ -218,4 +224,18 @@ public static boolean isEmpty (BlockState state) { public FluidState getFluidState(BlockState state) { return state.getValue(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getSource(false) : Fluids.EMPTY.defaultFluidState(); } + + @Override + public ItemRequirement getRequiredItems(BlockState state, BlockEntity blockEntity) { + int count = 0; + count += state.getValue(NORTH_FENCE)? 1 : 0; + count += state.getValue(EAST_FENCE)? 1 : 0; + count += state.getValue(SOUTH_FENCE)? 1 : 0; + count += state.getValue(WEST_FENCE)? 1 : 0; + + return new ItemRequirement( + ItemRequirement.ItemUseType.CONSUME, + new ItemStack(this.asItem(), count) + ); + } } diff --git a/common/src/main/java/com/github/talrey/createdeco/items/CatwalkBlockItem.java b/common/src/main/java/com/github/talrey/createdeco/items/CatwalkBlockItem.java index b25d3bd87..7a1b53f7d 100644 --- a/common/src/main/java/com/github/talrey/createdeco/items/CatwalkBlockItem.java +++ b/common/src/main/java/com/github/talrey/createdeco/items/CatwalkBlockItem.java @@ -1,12 +1,15 @@ package com.github.talrey.createdeco.items; +import com.github.talrey.createdeco.BlockRegistry; import com.github.talrey.createdeco.blocks.CatwalkBlock; +import com.github.talrey.createdeco.blocks.CatwalkRailingBlock; import net.createmod.catnip.placement.IPlacementHelper; import net.createmod.catnip.placement.PlacementHelpers; import net.createmod.catnip.placement.PlacementOffset; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; @@ -20,11 +23,15 @@ import java.util.function.Predicate; public class CatwalkBlockItem extends BlockItem { - private final int placementHelperID; + private final int extensionPlacementHelperID; + private final int catwalkPlacementHelperID; + private final int catwalkReplacementHelperID; public CatwalkBlockItem (CatwalkBlock block, Properties props) { super(block, props); - placementHelperID = PlacementHelpers.register(new CatwalkHelper()); + extensionPlacementHelperID = PlacementHelpers.register(new CatwalkExtensionHelper()); + catwalkPlacementHelperID = PlacementHelpers.register(new CatwalkPlacementHelper()); + catwalkReplacementHelperID = PlacementHelpers.register(new CatwalkReplacementHelper()); } @Override @@ -35,37 +42,189 @@ public InteractionResult useOn (UseOnContext ctx) { Player player = ctx.getPlayer(); BlockState state = world.getBlockState(pos); - IPlacementHelper helper = PlacementHelpers.get(placementHelperID); + IPlacementHelper extension_helper = PlacementHelpers.get(extensionPlacementHelperID); + IPlacementHelper placement_helper = PlacementHelpers.get(catwalkPlacementHelperID); + IPlacementHelper replacement_helper = PlacementHelpers.get(catwalkReplacementHelperID); BlockHitResult ray = new BlockHitResult(ctx.getClickLocation(), face, pos, true); - if (helper.matchesState(state) && player != null) { - return helper.getOffset(player, world, state, pos, ray).placeInWorld(world, this, player, ctx.getHand(), ray); + if (extension_helper.matchesState(state) && player != null) { + return extension_helper.getOffset(player, world, state, pos, ray).placeInWorld(world, this, player, ctx.getHand(), ray); + } else if (placement_helper.matchesState(state) && player != null) { + // This offset is only used to produce the ghost state, we don't use + // it to actually place the block. + PlacementOffset offset = placement_helper.getOffset(player, world, state, pos, ray); + + // Update the block state and consume a catwalk item + state = state.setValue(CatwalkBlock.CATWALK_BOTTOM, true); + world.setBlock(pos, state, 3); + ItemStack stack = ctx.getItemInHand(); + if (!player.getAbilities().instabuild) { + stack.shrink(1); + } + + return InteractionResult.SUCCESS; + } else if(replacement_helper.matchesState(state) && player != null) { + PlacementOffset offset = replacement_helper.getOffset(player, world, state, pos, ray); + if (offset.isSuccessful()) { + // The placeInWorld function has code to first check whether the current + // block can be replaced. That's not the case for catwalk railings, so + // we briefly replace the block with air, and then replace it with the + // catwalk block. + world.setBlock(pos, Blocks.AIR.defaultBlockState(), 0); + return offset.placeInWorld(world, this, player, ctx.getHand(), ray); + } } return super.useOn(ctx); } + /* + There are three placement helpers below. The first one is used to extend + catwalks horizontally. It applies to any catwalk blocks that have a catwalk + (top or bottom). When extending the catwalk, we copy the catwalk position, + so top catwalks will extend to create more top catwalks, and likewise for + bottom catwalks. + + The second placement helper is used to place a bottom catwalk in a catwalk + block that only has railing items. + + The third one is used to replace CatwalkRailingBlocks with CatwalkBlocks + when interacting with a catwalk item on a railing block. + */ + @MethodsReturnNonnullByDefault - public static class CatwalkHelper implements IPlacementHelper { + public class CatwalkExtensionHelper implements IPlacementHelper { @Override public Predicate getItemPredicate () { return CatwalkBlock::isCatwalk; } + // We only want to use this helper if the catwalk block has + // a catwalk (top or bottom). This way, this helper is mutually + // exclusive with the catwalk placement helper below. @Override public Predicate getStatePredicate () { - return state -> CatwalkBlock.isCatwalk(state.getBlock()); + return state -> CatwalkBlock.isCatwalk(state.getBlock()) && + state.getBlock() instanceof CatwalkBlock catblock && + CatwalkBlock.hasAnyCatwalks(state) && + // We also check that the metal of the item matches the metal of the + // catwalk block. + CatwalkBlockItem.this.getBlock().equals( + BlockRegistry.CATWALKS.get(catblock.metal).get() + ); } @Override public PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos, BlockHitResult ray) { + // The new block should have a catwalk in the same position as + // this block (so we copy that property), and no railings, because + // those need to be placed separately + BlockState newState = state + .setValue(CatwalkBlock.RAILING_NORTH, false) + .setValue(CatwalkBlock.RAILING_SOUTH, false) + .setValue(CatwalkBlock.RAILING_EAST, false) + .setValue(CatwalkBlock.RAILING_WEST, false); + Direction face = ray.getDirection(); if (face.getAxis() != Direction.Axis.Y) { - return PlacementOffset.success(pos.offset(face.getNormal()), offsetState -> offsetState); + return PlacementOffset.success(pos.offset(face.getNormal()), offsetState -> newState); } List dirs = IPlacementHelper.orderedByDistanceExceptAxis(pos, ray.getLocation(), Direction.Axis.Y); for (Direction dir : dirs) { BlockPos newPos = pos.relative(dir); if (!CatwalkBlock.canPlaceCatwalk(world, newPos)) continue; - return PlacementOffset.success(newPos, offsetState -> offsetState); + return PlacementOffset.success(newPos, offsetState -> newState); + } + return PlacementOffset.fail(); + } + } + + /** + This helper is used to place catwalks into catwalk blocks that only + contain railing items. + **/ + @MethodsReturnNonnullByDefault + public class CatwalkPlacementHelper implements IPlacementHelper { + @Override + public Predicate getItemPredicate () { + return CatwalkBlock::isCatwalk; + } + + // We only want to apply this helper if the block doesn't have any + // catwalks (top or bottom) in it. This way, the helper is mutually + // exclusive with the catwalk extension helper above. + @Override + public Predicate getStatePredicate () { + return state -> + CatwalkBlock.isCatwalk(state.getBlock()) && + // Check that the metal type of the block is the same as the + // block that corresponds to this item + ( + state.getBlock() instanceof CatwalkBlock catblock && + CatwalkBlockItem.this.getBlock() instanceof CatwalkBlock thiscatblock && + catblock.metal == thiscatblock.metal + ) && + !CatwalkBlock.hasAnyCatwalks(state); + } + + @Override + public PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos, BlockHitResult ray) { + // The ghost state should only contain the bottom catwalk + BlockState ghost_state = state + .setValue(CatwalkBlock.CATWALK_TOP, false) + .setValue(CatwalkBlock.CATWALK_BOTTOM, true) + .setValue(CatwalkBlock.RAILING_NORTH, false) + .setValue(CatwalkBlock.RAILING_SOUTH, false) + .setValue(CatwalkBlock.RAILING_EAST, false) + .setValue(CatwalkBlock.RAILING_WEST, false); + + return PlacementOffset.success(pos, offsetState -> ghost_state); + } + } + + /** + This helper is used to replace railing blocks with catwalk blocks when the player interacts with a legacy railing block. + This allows seamlessly replacing legacy blocks with catwalk blocks, without needing to breaking and replacing the block. + **/ + @MethodsReturnNonnullByDefault + public class CatwalkReplacementHelper implements IPlacementHelper { + @Override + public Predicate getItemPredicate () { + return CatwalkBlock::isCatwalk; + } + + @Override + public Predicate getStatePredicate () { + return state -> CatwalkRailingBlock.isRailing(state.getBlock()) && + // Check that the metal type of the block is the same as the + // block that corresponds to this item + ( + state.getBlock() instanceof CatwalkRailingBlock railblock && + CatwalkBlockItem.this.getBlock() instanceof CatwalkBlock thiscatblock && + railblock.metal == thiscatblock.metal + ); + } + + @Override + public PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos, BlockHitResult ray) { + // The ghost state should only contain the bottom catwalk + + if (state.getBlock() instanceof CatwalkRailingBlock catrail) { + String metal = catrail.metal; + // The ghost state only shows the added catwal + BlockState ghost_state = BlockRegistry.CATWALKS.get(metal).get() + .defaultBlockState() + .setValue(CatwalkBlock.CATWALK_BOTTOM, true); + + // But the updated state contains the new catwalk as well as any existing railings + BlockState new_state = BlockRegistry.CATWALKS.get(metal).get() + .defaultBlockState() + .setValue(CatwalkBlock.CATWALK_TOP, false) + .setValue(CatwalkBlock.CATWALK_BOTTOM, true) + .setValue(CatwalkBlock.RAILING_NORTH, state.getValue(CatwalkRailingBlock.NORTH_FENCE)) + .setValue(CatwalkBlock.RAILING_SOUTH, state.getValue(CatwalkRailingBlock.SOUTH_FENCE)) + .setValue(CatwalkBlock.RAILING_EAST, state.getValue(CatwalkRailingBlock.EAST_FENCE)) + .setValue(CatwalkBlock.RAILING_WEST, state.getValue(CatwalkRailingBlock.WEST_FENCE)); + + return PlacementOffset.success(pos, offsetState -> new_state).withGhostState(ghost_state); } return PlacementOffset.fail(); } diff --git a/common/src/main/java/com/github/talrey/createdeco/items/RailingBlockItem.java b/common/src/main/java/com/github/talrey/createdeco/items/RailingBlockItem.java index 5310efa56..416e391a1 100644 --- a/common/src/main/java/com/github/talrey/createdeco/items/RailingBlockItem.java +++ b/common/src/main/java/com/github/talrey/createdeco/items/RailingBlockItem.java @@ -3,6 +3,7 @@ import com.github.talrey.createdeco.BlockRegistry; import com.github.talrey.createdeco.blocks.CatwalkRailingBlock; import com.github.talrey.createdeco.blocks.CatwalkStairBlock; +import com.github.talrey.createdeco.blocks.CatwalkBlock; import net.createmod.catnip.placement.IPlacementHelper; import net.createmod.catnip.placement.PlacementHelpers; import net.createmod.catnip.placement.PlacementOffset; @@ -26,10 +27,12 @@ public class RailingBlockItem extends BlockItem { private final int placementHelperID; + private final int catwalkRailingHelperID; public RailingBlockItem (CatwalkRailingBlock block, Properties props) { super(block, props); placementHelperID = PlacementHelpers.register(new RailingHelper()); + catwalkRailingHelperID = PlacementHelpers.register(new CatwalkRailingHelper()); } @Override @@ -42,6 +45,7 @@ public InteractionResult useOn (UseOnContext ctx) { BlockState state = level.getBlockState(pos); IPlacementHelper helper = PlacementHelpers.get(placementHelperID); + IPlacementHelper catwalkHelper = PlacementHelpers.get(catwalkRailingHelperID); BlockHitResult ray = new BlockHitResult(ctx.getClickLocation(), face, pos, true); if (player == null) return InteractionResult.PASS; @@ -72,6 +76,7 @@ public InteractionResult useOn (UseOnContext ctx) { return InteractionResult.SUCCESS; } + // Interaction with CatwalkRailingBlock PlacementOffset offset = null; if (helper.matchesState(state)) { offset = helper.getOffset(player, level, state, pos, ray); @@ -93,6 +98,35 @@ public InteractionResult useOn (UseOnContext ctx) { return InteractionResult.SUCCESS; } + // Interaction with CatwalkBlock + // Check if the catwalk block is made of the same material + if (state.getBlock() instanceof CatwalkBlock catwalk + && this.getBlock().equals( + BlockRegistry.CATWALK_RAILINGS.get(catwalk.metal).get() + ) + ) { + offset = null; + if (catwalkHelper.matchesState(state)) { + offset = catwalkHelper.getOffset(player, level, state, pos, ray); + //return offset.placeInWorld(world, this, player, ctx.getHand(), ray); + } + + if (offset != null && offset.isSuccessful() && !player.isShiftKeyDown() + ) { + state = offset.getGhostState(); //level.getBlockState(offset.getBlockPos()); + var offsetPos = offset.getBlockPos(); + var soundType = state.getSoundType(); + + level.setBlock(offsetPos, offset.getTransform().apply(state), 3); + level.playSound(player, offsetPos, this.getPlaceSound(state), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); + level.gameEvent(GameEvent.BLOCK_PLACE, offsetPos, GameEvent.Context.of(player, state)); + if (!player.getAbilities().instabuild) { + stack.shrink(1); + } + return InteractionResult.SUCCESS; + } + } + return super.useOn(ctx); } @@ -143,4 +177,58 @@ public PlacementOffset getOffset ( return PlacementOffset.success(pos, newState -> finalState).withGhostState(finalState); } } + + @MethodsReturnNonnullByDefault + public class CatwalkRailingHelper implements IPlacementHelper { + @Override + public Predicate getItemPredicate () { + return CatwalkRailingBlock::isRailing; + } + + @Override + public Predicate getStatePredicate () { + return state -> CatwalkBlock.isCatwalk(state.getBlock()) && + // Check that the metal type of the block is the same as the + // block that corresponds to this item + ( + state.getBlock() instanceof CatwalkBlock catblock && + RailingBlockItem.this.getBlock() instanceof CatwalkRailingBlock thisrailblock && + catblock.metal == thisrailblock.metal + ) && + // We don't want to place rail blocks in catwalks that have a top catwalk + !state.getValue(CatwalkBlock.CATWALK_TOP); + } + + @Override + public PlacementOffset getOffset ( + Player player, Level world, BlockState state, BlockPos pos, BlockHitResult ray + ) { + Direction face = ray.getDirection(); + BlockState adjacent = world.getBlockState(pos.relative(face)); + + // Fail if the state already contains all railings + if ( + state.getValue(CatwalkBlock.RAILING_NORTH) && + state.getValue(CatwalkBlock.RAILING_SOUTH) && + state.getValue(CatwalkBlock.RAILING_EAST) && + state.getValue(CatwalkBlock.RAILING_WEST) + ) + { + return PlacementOffset.fail(); + } + + List dirs = IPlacementHelper.orderedByDistanceExceptAxis( + pos, ray.getLocation(), Direction.Axis.Y + ); + for (Direction offset : dirs) { + if (!state.getValue(CatwalkBlock.fromDirection(offset))) { + state = state.setValue(CatwalkBlock.fromDirection(offset), true); + break; + } + } + + BlockState finalState = state; + return PlacementOffset.success(pos, newState -> finalState).withGhostState(finalState); + } + } } diff --git a/fabric/src/main/java/com/github/talrey/createdeco/fabric/BlockStateGeneratorImpl.java b/fabric/src/main/java/com/github/talrey/createdeco/fabric/BlockStateGeneratorImpl.java index 7252b91d3..1be9ac0b4 100644 --- a/fabric/src/main/java/com/github/talrey/createdeco/fabric/BlockStateGeneratorImpl.java +++ b/fabric/src/main/java/com/github/talrey/createdeco/fabric/BlockStateGeneratorImpl.java @@ -4,6 +4,7 @@ import com.github.talrey.createdeco.blocks.DecalBlock; import com.github.talrey.createdeco.blocks.ShippingContainerBlock; import com.github.talrey.createdeco.blocks.SupportWedgeBlock; +import com.github.talrey.createdeco.blocks.CatwalkBlock; import com.simibubi.create.content.decoration.palettes.ConnectedGlassPaneBlock; import com.simibubi.create.content.decoration.palettes.ConnectedPillarBlock; import com.simibubi.create.foundation.data.CreateRegistrate; @@ -313,20 +314,37 @@ public static void catwalk( ResourceLocation catwalkTexture = prov.modLoc("block/palettes/catwalks/" + metal.toLowerCase(Locale.ROOT).replaceAll(" ", "_") + "_catwalk"); ResourceLocation supportTexture = prov.modLoc("block/palettes/support/" + metal.toLowerCase(Locale.ROOT).replaceAll(" ", "_") + "_support"); - BlockModelBuilder catwalk = prov.models() + BlockModelBuilder catwalk_top = prov.models() .withExistingParent(metal + "_catwalk", prov.modLoc("block/catwalk_top")) .texture("2", catwalkTexture) .texture("particle", catwalkTexture); + prov.getMultipartBuilder(ctx.get()).part().modelFile(catwalk_top).addModel() + .condition(CatwalkBlock.CATWALK_TOP, true).end(); + + BlockModelBuilder catwalk_bottom = prov.models() + .withExistingParent(metal + "_catwalk_down", prov.modLoc("block/catwalk_bottom")) + .texture("2", catwalkTexture) + .texture("particle", catwalkTexture); + prov.getMultipartBuilder(ctx.get()).part().modelFile(catwalk_bottom).addModel() + .condition(CatwalkBlock.CATWALK_BOTTOM, true).end(); + + BlockModelBuilder rail = prov.models() + .withExistingParent(metal + "_catwalk_railing", prov.modLoc("block/catwalk_rail")); + prov.getMultipartBuilder(ctx.get()).part().modelFile(rail).rotationY( 90).addModel() + .condition(CatwalkBlock.RAILING_NORTH, true).end(); + prov.getMultipartBuilder(ctx.get()).part().modelFile(rail).rotationY(180).addModel() + .condition(CatwalkBlock.RAILING_EAST, true).end(); + prov.getMultipartBuilder(ctx.get()).part().modelFile(rail).rotationY(270).addModel() + .condition(CatwalkBlock.RAILING_SOUTH, true).end(); + prov.getMultipartBuilder(ctx.get()).part().modelFile(rail).rotationY( 0).addModel() + .condition(CatwalkBlock.RAILING_WEST, true).end(); BlockModelBuilder support = prov.models() .withExistingParent(metal + "_catwalk_support", prov.modLoc("block/catwalk_support")) .texture("0", supportTexture) .texture("particle", supportTexture); - - - prov.getMultipartBuilder(ctx.get()).part().modelFile(catwalk).addModel().end(); prov.getMultipartBuilder(ctx.get()).part().modelFile(support).addModel() - .condition(BlockStateProperties.BOTTOM, true).end(); + .condition(CatwalkBlock.BOTTOM, true).end(); }