From 2696fc2a5148978d1fb3f0dcde3d1a6d01ec33e9 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 12 May 2020 14:06:50 +0200 Subject: [PATCH] BlockState gen progress - Clutch, Gearshift and Gearbox joined the registrate - Fixed belt and gearbox items not being assigned creative tabs properly - Cleaned up and extended the blockstate generator helpers - Removed advancements from static assets - Added datagen .cache to gitignore - Split the palettes section into its own Creative tab - Fixed Clutch and Gearshift rendering their casing in the TER --- .gitignore | 3 +- .../assets/create/blockstates/clutch.json | 28 +++++++ .../create/blockstates/creative_crate.json | 7 -- .../assets/create/blockstates/gearbox.json | 16 ++++ .../assets/create/blockstates/gearshift.json | 28 +++++++ .../resources/assets/create/lang/en_ud.json | 4 +- .../resources/assets/create/lang/en_us.json | 4 +- .../assets/create/models/item/clutch.json | 3 + .../create/models/item/creative_crate.json | 3 - .../assets/create/models/item/gearbox.json | 3 + .../assets/create/models/item/gearshift.json | 3 + .../create/advancements/andesite_alloy.json | 0 .../create/advancements/andesite_casing.json | 0 .../data/create/advancements/basin.json | 0 .../data/create/advancements/belt.json | 0 .../data/create/advancements/brass.json | 0 .../create/advancements/brass_casing.json | 0 .../advancements/chromatic_compound.json | 0 .../data/create/advancements/compact.json | 0 .../create/advancements/copper_casing.json | 0 .../data/create/advancements/copper_end.json | 0 .../data/create/advancements/crafter.json | 0 .../create/advancements/crushing_wheel.json | 0 .../data/create/advancements/deforester.json | 3 +- .../data/create/advancements/deployer.json | 0 .../data/create/advancements/drill.json | 0 .../create/advancements/electron_tube.json | 0 .../data/create/advancements/fist_bump.json | 0 .../data/create/advancements/goggles.json | 0 .../data/create/advancements/its_alive.json | 0 .../data/create/advancements/lava_wheel.json | 0 .../data/create/advancements/millstone.json | 0 .../data/create/advancements/mixer.json | 0 .../create/advancements/overstressed.json | 0 .../advancements/polished_rose_quartz.json | 0 .../data/create/advancements/press.json | 0 .../create/advancements/refined_radiance.json | 0 .../data/create/advancements/root.json | 0 .../data/create/advancements/saw.json | 0 .../data/create/advancements/shadow_end.json | 0 .../create/advancements/shadow_steel.json | 0 .../create/advancements/shifting_gears.json | 0 .../data/create/advancements/speed_gauge.json | 0 .../create/advancements/stress_gauge.json | 0 .../create/advancements/symmetry_wand.json | 0 .../create/advancements/upgraded_zapper.json | 0 .../data/create/advancements/water_wheel.json | 0 .../data/create/advancements/wrench.json | 0 .../data/create/advancements/zapper.json | 0 .../data/forge/tags/items/ingots.json | 9 +++ .../data/forge/tags/items/ingots/brass.json | 7 ++ .../data/forge/tags/items/ingots/copper.json | 7 ++ .../data/forge/tags/items/ingots/zinc.json | 7 ++ .../data/forge/tags/items/nuggets.json | 9 +++ .../data/forge/tags/items/nuggets/brass.json | 7 ++ .../data/forge/tags/items/nuggets/copper.json | 7 ++ .../data/forge/tags/items/nuggets/zinc.json | 7 ++ .../data/forge/tags/items/plates.json | 11 +++ .../data/forge/tags/items/plates/brass.json | 7 ++ .../data/forge/tags/items/plates/copper.json | 7 ++ .../data/forge/tags/items/plates/gold.json | 7 ++ .../data/forge/tags/items/plates/iron.json | 7 ++ .../data/forge/tags/items/plates/lapis.json | 7 ++ .../java/com/simibubi/create/AllBlocks.java | 9 +-- .../com/simibubi/create/AllBlocksNew.java | 50 +++++++++--- .../java/com/simibubi/create/AllItems.java | 2 +- .../com/simibubi/create/AllTileEntities.java | 6 +- src/main/java/com/simibubi/create/Create.java | 6 +- .../com/simibubi/create/CreateItemGroup.java | 66 ++++------------ .../simibubi/create/CreateItemGroupBase.java | 69 ++++++++++++++++ .../com/simibubi/create/CreateRegistrate.java | 2 +- .../create/foundation/item/IAddedByOther.java | 5 -- .../foundation/utility/data/AssetLookup.java | 58 ++++++++++++++ .../utility/data/BlockStateGen.java | 66 ++++++---------- .../base/KineticTileEntityRenderer.java | 28 +++++-- .../MechanicalPistonTileEntityRenderer.java | 6 +- .../deployer/DeployerTileEntityRenderer.java | 10 +-- .../MechanicalPressTileEntityRenderer.java | 7 +- .../components/saw/SawTileEntityRenderer.java | 6 +- .../advanced/SpeedControllerRenderer.java | 11 +-- .../contraptions/relays/belt/BeltBlock.java | 7 ++ .../relays/belt/item/BeltConnectorItem.java | 79 ++++++++++++------- .../relays/encased/ClutchBlock.java | 4 + .../EncasedShaftTileEntityRenderer.java | 5 +- .../relays/encased/GearshiftBlock.java | 5 +- .../encased/SplitShaftTileEntityRenderer.java | 1 - .../relays/gauge/GaugeTileEntityRenderer.java | 22 +++--- .../relays/gearbox/GearboxBlock.java | 7 +- .../relays/gearbox/VerticalGearboxItem.java | 29 +++++-- .../zapper/blockzapper/BlockzapperItem.java | 2 +- .../modules/palettes/PalettesItemGroup.java | 37 +++++++++ .../assets/create/blockstates/clutch.json | 10 --- .../assets/create/blockstates/gearbox.json | 7 -- .../assets/create/blockstates/gearshift.json | 10 --- .../resources/assets/create/lang/en_us.json | 3 +- .../{clutch_off.json => clutch/block.json} | 2 +- .../block_powered.json} | 2 +- .../clutch.json => block/clutch/item.json} | 0 .../{gearbox.json => gearbox/block.json} | 0 .../gearbox.json => block/gearbox/item.json} | 0 .../create/models/block/gearshift/block.json | 68 ++++++++++++++++ .../block_powered.json} | 2 +- .../gearshift/item.json} | 0 .../create/models/block/gearshift_off.json | 68 ---------------- .../stonecutting/polished_dark_scoria.json | 8 +- 105 files changed, 656 insertions(+), 340 deletions(-) create mode 100644 src/generated/resources/assets/create/blockstates/clutch.json delete mode 100644 src/generated/resources/assets/create/blockstates/creative_crate.json create mode 100644 src/generated/resources/assets/create/blockstates/gearbox.json create mode 100644 src/generated/resources/assets/create/blockstates/gearshift.json create mode 100644 src/generated/resources/assets/create/models/item/clutch.json delete mode 100644 src/generated/resources/assets/create/models/item/creative_crate.json create mode 100644 src/generated/resources/assets/create/models/item/gearbox.json create mode 100644 src/generated/resources/assets/create/models/item/gearshift.json rename src/{main => generated}/resources/data/create/advancements/andesite_alloy.json (100%) rename src/{main => generated}/resources/data/create/advancements/andesite_casing.json (100%) rename src/{main => generated}/resources/data/create/advancements/basin.json (100%) rename src/{main => generated}/resources/data/create/advancements/belt.json (100%) rename src/{main => generated}/resources/data/create/advancements/brass.json (100%) rename src/{main => generated}/resources/data/create/advancements/brass_casing.json (100%) rename src/{main => generated}/resources/data/create/advancements/chromatic_compound.json (100%) rename src/{main => generated}/resources/data/create/advancements/compact.json (100%) rename src/{main => generated}/resources/data/create/advancements/copper_casing.json (100%) rename src/{main => generated}/resources/data/create/advancements/copper_end.json (100%) rename src/{main => generated}/resources/data/create/advancements/crafter.json (100%) rename src/{main => generated}/resources/data/create/advancements/crushing_wheel.json (100%) rename src/{main => generated}/resources/data/create/advancements/deforester.json (90%) rename src/{main => generated}/resources/data/create/advancements/deployer.json (100%) rename src/{main => generated}/resources/data/create/advancements/drill.json (100%) rename src/{main => generated}/resources/data/create/advancements/electron_tube.json (100%) rename src/{main => generated}/resources/data/create/advancements/fist_bump.json (100%) rename src/{main => generated}/resources/data/create/advancements/goggles.json (100%) rename src/{main => generated}/resources/data/create/advancements/its_alive.json (100%) rename src/{main => generated}/resources/data/create/advancements/lava_wheel.json (100%) rename src/{main => generated}/resources/data/create/advancements/millstone.json (100%) rename src/{main => generated}/resources/data/create/advancements/mixer.json (100%) rename src/{main => generated}/resources/data/create/advancements/overstressed.json (100%) rename src/{main => generated}/resources/data/create/advancements/polished_rose_quartz.json (100%) rename src/{main => generated}/resources/data/create/advancements/press.json (100%) rename src/{main => generated}/resources/data/create/advancements/refined_radiance.json (100%) rename src/{main => generated}/resources/data/create/advancements/root.json (100%) rename src/{main => generated}/resources/data/create/advancements/saw.json (100%) rename src/{main => generated}/resources/data/create/advancements/shadow_end.json (100%) rename src/{main => generated}/resources/data/create/advancements/shadow_steel.json (100%) rename src/{main => generated}/resources/data/create/advancements/shifting_gears.json (100%) rename src/{main => generated}/resources/data/create/advancements/speed_gauge.json (100%) rename src/{main => generated}/resources/data/create/advancements/stress_gauge.json (100%) rename src/{main => generated}/resources/data/create/advancements/symmetry_wand.json (100%) rename src/{main => generated}/resources/data/create/advancements/upgraded_zapper.json (100%) rename src/{main => generated}/resources/data/create/advancements/water_wheel.json (100%) rename src/{main => generated}/resources/data/create/advancements/wrench.json (100%) rename src/{main => generated}/resources/data/create/advancements/zapper.json (100%) create mode 100644 src/generated/resources/data/forge/tags/items/ingots.json create mode 100644 src/generated/resources/data/forge/tags/items/ingots/brass.json create mode 100644 src/generated/resources/data/forge/tags/items/ingots/copper.json create mode 100644 src/generated/resources/data/forge/tags/items/ingots/zinc.json create mode 100644 src/generated/resources/data/forge/tags/items/nuggets.json create mode 100644 src/generated/resources/data/forge/tags/items/nuggets/brass.json create mode 100644 src/generated/resources/data/forge/tags/items/nuggets/copper.json create mode 100644 src/generated/resources/data/forge/tags/items/nuggets/zinc.json create mode 100644 src/generated/resources/data/forge/tags/items/plates.json create mode 100644 src/generated/resources/data/forge/tags/items/plates/brass.json create mode 100644 src/generated/resources/data/forge/tags/items/plates/copper.json create mode 100644 src/generated/resources/data/forge/tags/items/plates/gold.json create mode 100644 src/generated/resources/data/forge/tags/items/plates/iron.json create mode 100644 src/generated/resources/data/forge/tags/items/plates/lapis.json create mode 100644 src/main/java/com/simibubi/create/CreateItemGroupBase.java delete mode 100644 src/main/java/com/simibubi/create/foundation/item/IAddedByOther.java create mode 100644 src/main/java/com/simibubi/create/foundation/utility/data/AssetLookup.java create mode 100644 src/main/java/com/simibubi/create/modules/palettes/PalettesItemGroup.java delete mode 100644 src/main/resources/assets/create/blockstates/clutch.json delete mode 100644 src/main/resources/assets/create/blockstates/gearbox.json delete mode 100644 src/main/resources/assets/create/blockstates/gearshift.json rename src/main/resources/assets/create/models/block/{clutch_off.json => clutch/block.json} (71%) rename src/main/resources/assets/create/models/block/{clutch_on.json => clutch/block_powered.json} (71%) rename src/main/resources/assets/create/models/{item/clutch.json => block/clutch/item.json} (100%) rename src/main/resources/assets/create/models/block/{gearbox.json => gearbox/block.json} (100%) rename src/main/resources/assets/create/models/{item/gearbox.json => block/gearbox/item.json} (100%) create mode 100644 src/main/resources/assets/create/models/block/gearshift/block.json rename src/main/resources/assets/create/models/block/{gearshift_on.json => gearshift/block_powered.json} (72%) rename src/main/resources/assets/create/models/{item/gearshift.json => block/gearshift/item.json} (100%) delete mode 100644 src/main/resources/assets/create/models/block/gearshift_off.json diff --git a/.gitignore b/.gitignore index f8a3cd828..f5e691153 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,5 @@ local.properties .cproject # PDT-specific -.buildpath \ No newline at end of file +.buildpath +src/generated/resources/.cache/cache diff --git a/src/generated/resources/assets/create/blockstates/clutch.json b/src/generated/resources/assets/create/blockstates/clutch.json new file mode 100644 index 000000000..75d0ed556 --- /dev/null +++ b/src/generated/resources/assets/create/blockstates/clutch.json @@ -0,0 +1,28 @@ +{ + "variants": { + "axis=x,powered=false": { + "model": "create:block/clutch/block", + "x": 90, + "y": 90 + }, + "axis=y,powered=false": { + "model": "create:block/clutch/block" + }, + "axis=z,powered=false": { + "model": "create:block/clutch/block", + "x": 90 + }, + "axis=x,powered=true": { + "model": "create:block/clutch/block_powered", + "x": 90, + "y": 90 + }, + "axis=y,powered=true": { + "model": "create:block/clutch/block_powered" + }, + "axis=z,powered=true": { + "model": "create:block/clutch/block_powered", + "x": 90 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/blockstates/creative_crate.json b/src/generated/resources/assets/create/blockstates/creative_crate.json deleted file mode 100644 index 88094affc..000000000 --- a/src/generated/resources/assets/create/blockstates/creative_crate.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "": { - "model": "create:block/creative_crate" - } - } -} \ No newline at end of file diff --git a/src/generated/resources/assets/create/blockstates/gearbox.json b/src/generated/resources/assets/create/blockstates/gearbox.json new file mode 100644 index 000000000..9bb9f7d2b --- /dev/null +++ b/src/generated/resources/assets/create/blockstates/gearbox.json @@ -0,0 +1,16 @@ +{ + "variants": { + "axis=x": { + "model": "create:block/gearbox/block", + "x": 90, + "y": 90 + }, + "axis=y": { + "model": "create:block/gearbox/block" + }, + "axis=z": { + "model": "create:block/gearbox/block", + "x": 90 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/blockstates/gearshift.json b/src/generated/resources/assets/create/blockstates/gearshift.json new file mode 100644 index 000000000..edabe0d43 --- /dev/null +++ b/src/generated/resources/assets/create/blockstates/gearshift.json @@ -0,0 +1,28 @@ +{ + "variants": { + "axis=x,powered=false": { + "model": "create:block/gearshift/block", + "x": 90, + "y": 90 + }, + "axis=y,powered=false": { + "model": "create:block/gearshift/block" + }, + "axis=z,powered=false": { + "model": "create:block/gearshift/block", + "x": 90 + }, + "axis=x,powered=true": { + "model": "create:block/gearshift/block_powered", + "x": 90, + "y": 90 + }, + "axis=y,powered=true": { + "model": "create:block/gearshift/block_powered" + }, + "axis=z,powered=true": { + "model": "create:block/gearshift/block_powered", + "x": 90 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/lang/en_ud.json b/src/generated/resources/assets/create/lang/en_ud.json index 2e017b080..b4eb0fb59 100644 --- a/src/generated/resources/assets/create/lang/en_ud.json +++ b/src/generated/resources/assets/create/lang/en_ud.json @@ -1,6 +1,6 @@ { + "block.create.clutch": "\u0265\u0254\u0287n\u05DF\u0186", "block.create.cogwheel": "\u05DF\u01DD\u01DD\u0265\u028Dbo\u0186", - "block.create.creative_crate": "\u01DD\u0287\u0250\u0279\u0186 \u01DD\u028C\u0131\u0287\u0250\u01DD\u0279\u0186", "block.create.dark_scoria_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1", "block.create.dark_scoria_bricks_stairs": "s\u0279\u0131\u0250\u0287S s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1", "block.create.dark_scoria_bricks_wall": "\u05DF\u05DF\u0250M s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1", @@ -15,6 +15,8 @@ "block.create.gabbro_slab": "q\u0250\u05DFS o\u0279qq\u0250\u2141", "block.create.gabbro_stairs": "s\u0279\u0131\u0250\u0287S o\u0279qq\u0250\u2141", "block.create.gabbro_wall": "\u05DF\u05DF\u0250M o\u0279qq\u0250\u2141", + "block.create.gearbox": "xoq\u0279\u0250\u01DD\u2141", + "block.create.gearshift": "\u0287\u025F\u0131\u0265s\u0279\u0250\u01DD\u2141", "block.create.indented_gabbro_slab": "q\u0250\u05DFS o\u0279qq\u0250\u2141 p\u01DD\u0287u\u01DDpuI", "block.create.large_cogwheel": "\u05DF\u01DD\u01DD\u0265\u028Dbo\u0186 \u01DDb\u0279\u0250\uA780", "block.create.limestone_bricks_slab": "q\u0250\u05DFS s\u029E\u0254\u0131\u0279\u15FA \u01DDuo\u0287s\u01DD\u026F\u0131\uA780", diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index 1ee2e27b6..c2ad2aaf6 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -1,6 +1,6 @@ { + "block.create.clutch": "Clutch", "block.create.cogwheel": "Cogwheel", - "block.create.creative_crate": "Creative Crate", "block.create.dark_scoria_bricks_slab": "Dark Scoria Bricks Slab", "block.create.dark_scoria_bricks_stairs": "Dark Scoria Bricks Stairs", "block.create.dark_scoria_bricks_wall": "Dark Scoria Bricks Wall", @@ -15,6 +15,8 @@ "block.create.gabbro_slab": "Gabbro Slab", "block.create.gabbro_stairs": "Gabbro Stairs", "block.create.gabbro_wall": "Gabbro Wall", + "block.create.gearbox": "Gearbox", + "block.create.gearshift": "Gearshift", "block.create.indented_gabbro_slab": "Indented Gabbro Slab", "block.create.large_cogwheel": "Large Cogwheel", "block.create.limestone_bricks_slab": "Limestone Bricks Slab", diff --git a/src/generated/resources/assets/create/models/item/clutch.json b/src/generated/resources/assets/create/models/item/clutch.json new file mode 100644 index 000000000..76818b044 --- /dev/null +++ b/src/generated/resources/assets/create/models/item/clutch.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/clutch/item" +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/item/creative_crate.json b/src/generated/resources/assets/create/models/item/creative_crate.json deleted file mode 100644 index 987b4a166..000000000 --- a/src/generated/resources/assets/create/models/item/creative_crate.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "parent": "create:block/creative_crate" -} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/item/gearbox.json b/src/generated/resources/assets/create/models/item/gearbox.json new file mode 100644 index 000000000..7fd5b83c9 --- /dev/null +++ b/src/generated/resources/assets/create/models/item/gearbox.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/gearbox/item" +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/item/gearshift.json b/src/generated/resources/assets/create/models/item/gearshift.json new file mode 100644 index 000000000..2a7aab795 --- /dev/null +++ b/src/generated/resources/assets/create/models/item/gearshift.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/gearshift/item" +} \ No newline at end of file diff --git a/src/main/resources/data/create/advancements/andesite_alloy.json b/src/generated/resources/data/create/advancements/andesite_alloy.json similarity index 100% rename from src/main/resources/data/create/advancements/andesite_alloy.json rename to src/generated/resources/data/create/advancements/andesite_alloy.json diff --git a/src/main/resources/data/create/advancements/andesite_casing.json b/src/generated/resources/data/create/advancements/andesite_casing.json similarity index 100% rename from src/main/resources/data/create/advancements/andesite_casing.json rename to src/generated/resources/data/create/advancements/andesite_casing.json diff --git a/src/main/resources/data/create/advancements/basin.json b/src/generated/resources/data/create/advancements/basin.json similarity index 100% rename from src/main/resources/data/create/advancements/basin.json rename to src/generated/resources/data/create/advancements/basin.json diff --git a/src/main/resources/data/create/advancements/belt.json b/src/generated/resources/data/create/advancements/belt.json similarity index 100% rename from src/main/resources/data/create/advancements/belt.json rename to src/generated/resources/data/create/advancements/belt.json diff --git a/src/main/resources/data/create/advancements/brass.json b/src/generated/resources/data/create/advancements/brass.json similarity index 100% rename from src/main/resources/data/create/advancements/brass.json rename to src/generated/resources/data/create/advancements/brass.json diff --git a/src/main/resources/data/create/advancements/brass_casing.json b/src/generated/resources/data/create/advancements/brass_casing.json similarity index 100% rename from src/main/resources/data/create/advancements/brass_casing.json rename to src/generated/resources/data/create/advancements/brass_casing.json diff --git a/src/main/resources/data/create/advancements/chromatic_compound.json b/src/generated/resources/data/create/advancements/chromatic_compound.json similarity index 100% rename from src/main/resources/data/create/advancements/chromatic_compound.json rename to src/generated/resources/data/create/advancements/chromatic_compound.json diff --git a/src/main/resources/data/create/advancements/compact.json b/src/generated/resources/data/create/advancements/compact.json similarity index 100% rename from src/main/resources/data/create/advancements/compact.json rename to src/generated/resources/data/create/advancements/compact.json diff --git a/src/main/resources/data/create/advancements/copper_casing.json b/src/generated/resources/data/create/advancements/copper_casing.json similarity index 100% rename from src/main/resources/data/create/advancements/copper_casing.json rename to src/generated/resources/data/create/advancements/copper_casing.json diff --git a/src/main/resources/data/create/advancements/copper_end.json b/src/generated/resources/data/create/advancements/copper_end.json similarity index 100% rename from src/main/resources/data/create/advancements/copper_end.json rename to src/generated/resources/data/create/advancements/copper_end.json diff --git a/src/main/resources/data/create/advancements/crafter.json b/src/generated/resources/data/create/advancements/crafter.json similarity index 100% rename from src/main/resources/data/create/advancements/crafter.json rename to src/generated/resources/data/create/advancements/crafter.json diff --git a/src/main/resources/data/create/advancements/crushing_wheel.json b/src/generated/resources/data/create/advancements/crushing_wheel.json similarity index 100% rename from src/main/resources/data/create/advancements/crushing_wheel.json rename to src/generated/resources/data/create/advancements/crushing_wheel.json diff --git a/src/main/resources/data/create/advancements/deforester.json b/src/generated/resources/data/create/advancements/deforester.json similarity index 90% rename from src/main/resources/data/create/advancements/deforester.json rename to src/generated/resources/data/create/advancements/deforester.json index 55f8d4606..c0db60900 100644 --- a/src/main/resources/data/create/advancements/deforester.json +++ b/src/generated/resources/data/create/advancements/deforester.json @@ -2,7 +2,8 @@ "parent": "create:refined_radiance", "display": { "icon": { - "item": "create:deforester" + "item": "create:deforester", + "nbt": "{Damage:0}" }, "title": { "translate": "advancement.create.deforester" diff --git a/src/main/resources/data/create/advancements/deployer.json b/src/generated/resources/data/create/advancements/deployer.json similarity index 100% rename from src/main/resources/data/create/advancements/deployer.json rename to src/generated/resources/data/create/advancements/deployer.json diff --git a/src/main/resources/data/create/advancements/drill.json b/src/generated/resources/data/create/advancements/drill.json similarity index 100% rename from src/main/resources/data/create/advancements/drill.json rename to src/generated/resources/data/create/advancements/drill.json diff --git a/src/main/resources/data/create/advancements/electron_tube.json b/src/generated/resources/data/create/advancements/electron_tube.json similarity index 100% rename from src/main/resources/data/create/advancements/electron_tube.json rename to src/generated/resources/data/create/advancements/electron_tube.json diff --git a/src/main/resources/data/create/advancements/fist_bump.json b/src/generated/resources/data/create/advancements/fist_bump.json similarity index 100% rename from src/main/resources/data/create/advancements/fist_bump.json rename to src/generated/resources/data/create/advancements/fist_bump.json diff --git a/src/main/resources/data/create/advancements/goggles.json b/src/generated/resources/data/create/advancements/goggles.json similarity index 100% rename from src/main/resources/data/create/advancements/goggles.json rename to src/generated/resources/data/create/advancements/goggles.json diff --git a/src/main/resources/data/create/advancements/its_alive.json b/src/generated/resources/data/create/advancements/its_alive.json similarity index 100% rename from src/main/resources/data/create/advancements/its_alive.json rename to src/generated/resources/data/create/advancements/its_alive.json diff --git a/src/main/resources/data/create/advancements/lava_wheel.json b/src/generated/resources/data/create/advancements/lava_wheel.json similarity index 100% rename from src/main/resources/data/create/advancements/lava_wheel.json rename to src/generated/resources/data/create/advancements/lava_wheel.json diff --git a/src/main/resources/data/create/advancements/millstone.json b/src/generated/resources/data/create/advancements/millstone.json similarity index 100% rename from src/main/resources/data/create/advancements/millstone.json rename to src/generated/resources/data/create/advancements/millstone.json diff --git a/src/main/resources/data/create/advancements/mixer.json b/src/generated/resources/data/create/advancements/mixer.json similarity index 100% rename from src/main/resources/data/create/advancements/mixer.json rename to src/generated/resources/data/create/advancements/mixer.json diff --git a/src/main/resources/data/create/advancements/overstressed.json b/src/generated/resources/data/create/advancements/overstressed.json similarity index 100% rename from src/main/resources/data/create/advancements/overstressed.json rename to src/generated/resources/data/create/advancements/overstressed.json diff --git a/src/main/resources/data/create/advancements/polished_rose_quartz.json b/src/generated/resources/data/create/advancements/polished_rose_quartz.json similarity index 100% rename from src/main/resources/data/create/advancements/polished_rose_quartz.json rename to src/generated/resources/data/create/advancements/polished_rose_quartz.json diff --git a/src/main/resources/data/create/advancements/press.json b/src/generated/resources/data/create/advancements/press.json similarity index 100% rename from src/main/resources/data/create/advancements/press.json rename to src/generated/resources/data/create/advancements/press.json diff --git a/src/main/resources/data/create/advancements/refined_radiance.json b/src/generated/resources/data/create/advancements/refined_radiance.json similarity index 100% rename from src/main/resources/data/create/advancements/refined_radiance.json rename to src/generated/resources/data/create/advancements/refined_radiance.json diff --git a/src/main/resources/data/create/advancements/root.json b/src/generated/resources/data/create/advancements/root.json similarity index 100% rename from src/main/resources/data/create/advancements/root.json rename to src/generated/resources/data/create/advancements/root.json diff --git a/src/main/resources/data/create/advancements/saw.json b/src/generated/resources/data/create/advancements/saw.json similarity index 100% rename from src/main/resources/data/create/advancements/saw.json rename to src/generated/resources/data/create/advancements/saw.json diff --git a/src/main/resources/data/create/advancements/shadow_end.json b/src/generated/resources/data/create/advancements/shadow_end.json similarity index 100% rename from src/main/resources/data/create/advancements/shadow_end.json rename to src/generated/resources/data/create/advancements/shadow_end.json diff --git a/src/main/resources/data/create/advancements/shadow_steel.json b/src/generated/resources/data/create/advancements/shadow_steel.json similarity index 100% rename from src/main/resources/data/create/advancements/shadow_steel.json rename to src/generated/resources/data/create/advancements/shadow_steel.json diff --git a/src/main/resources/data/create/advancements/shifting_gears.json b/src/generated/resources/data/create/advancements/shifting_gears.json similarity index 100% rename from src/main/resources/data/create/advancements/shifting_gears.json rename to src/generated/resources/data/create/advancements/shifting_gears.json diff --git a/src/main/resources/data/create/advancements/speed_gauge.json b/src/generated/resources/data/create/advancements/speed_gauge.json similarity index 100% rename from src/main/resources/data/create/advancements/speed_gauge.json rename to src/generated/resources/data/create/advancements/speed_gauge.json diff --git a/src/main/resources/data/create/advancements/stress_gauge.json b/src/generated/resources/data/create/advancements/stress_gauge.json similarity index 100% rename from src/main/resources/data/create/advancements/stress_gauge.json rename to src/generated/resources/data/create/advancements/stress_gauge.json diff --git a/src/main/resources/data/create/advancements/symmetry_wand.json b/src/generated/resources/data/create/advancements/symmetry_wand.json similarity index 100% rename from src/main/resources/data/create/advancements/symmetry_wand.json rename to src/generated/resources/data/create/advancements/symmetry_wand.json diff --git a/src/main/resources/data/create/advancements/upgraded_zapper.json b/src/generated/resources/data/create/advancements/upgraded_zapper.json similarity index 100% rename from src/main/resources/data/create/advancements/upgraded_zapper.json rename to src/generated/resources/data/create/advancements/upgraded_zapper.json diff --git a/src/main/resources/data/create/advancements/water_wheel.json b/src/generated/resources/data/create/advancements/water_wheel.json similarity index 100% rename from src/main/resources/data/create/advancements/water_wheel.json rename to src/generated/resources/data/create/advancements/water_wheel.json diff --git a/src/main/resources/data/create/advancements/wrench.json b/src/generated/resources/data/create/advancements/wrench.json similarity index 100% rename from src/main/resources/data/create/advancements/wrench.json rename to src/generated/resources/data/create/advancements/wrench.json diff --git a/src/main/resources/data/create/advancements/zapper.json b/src/generated/resources/data/create/advancements/zapper.json similarity index 100% rename from src/main/resources/data/create/advancements/zapper.json rename to src/generated/resources/data/create/advancements/zapper.json diff --git a/src/generated/resources/data/forge/tags/items/ingots.json b/src/generated/resources/data/forge/tags/items/ingots.json new file mode 100644 index 000000000..efda80e5f --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/ingots.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "values": [ + "#forge:ingots/copper", + "#forge:ingots/zinc", + "#forge:ingots/brass" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/brass.json b/src/generated/resources/data/forge/tags/items/ingots/brass.json new file mode 100644 index 000000000..4d5ab01cb --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/ingots/brass.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "create:brass_ingot" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/copper.json b/src/generated/resources/data/forge/tags/items/ingots/copper.json new file mode 100644 index 000000000..bc30b7115 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/ingots/copper.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "create:copper_ingot" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/ingots/zinc.json b/src/generated/resources/data/forge/tags/items/ingots/zinc.json new file mode 100644 index 000000000..7a42265a5 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/ingots/zinc.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "create:zinc_ingot" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nuggets.json b/src/generated/resources/data/forge/tags/items/nuggets.json new file mode 100644 index 000000000..094297265 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/nuggets.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "values": [ + "#forge:nuggets/copper", + "#forge:nuggets/zinc", + "#forge:nuggets/brass" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nuggets/brass.json b/src/generated/resources/data/forge/tags/items/nuggets/brass.json new file mode 100644 index 000000000..30e194d7d --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/nuggets/brass.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "create:brass_nugget" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nuggets/copper.json b/src/generated/resources/data/forge/tags/items/nuggets/copper.json new file mode 100644 index 000000000..3deec82e6 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/nuggets/copper.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "create:copper_nugget" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/nuggets/zinc.json b/src/generated/resources/data/forge/tags/items/nuggets/zinc.json new file mode 100644 index 000000000..fc489bb84 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/nuggets/zinc.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "create:zinc_nugget" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/plates.json b/src/generated/resources/data/forge/tags/items/plates.json new file mode 100644 index 000000000..8a7b79217 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/plates.json @@ -0,0 +1,11 @@ +{ + "replace": false, + "values": [ + "#forge:plates/iron", + "#forge:plates/gold", + "#forge:plates/copper", + "#forge:plates/brass", + "#forge:plates/lapis" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/plates/brass.json b/src/generated/resources/data/forge/tags/items/plates/brass.json new file mode 100644 index 000000000..2761c5fc2 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/plates/brass.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "create:brass_sheet" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/plates/copper.json b/src/generated/resources/data/forge/tags/items/plates/copper.json new file mode 100644 index 000000000..6bc090997 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/plates/copper.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "create:copper_sheet" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/plates/gold.json b/src/generated/resources/data/forge/tags/items/plates/gold.json new file mode 100644 index 000000000..7565583d7 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/plates/gold.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "create:gold_sheet" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/plates/iron.json b/src/generated/resources/data/forge/tags/items/plates/iron.json new file mode 100644 index 000000000..8d1bfb6bf --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/plates/iron.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "create:iron_sheet" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/plates/lapis.json b/src/generated/resources/data/forge/tags/items/plates/lapis.json new file mode 100644 index 000000000..7c41b4945 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/plates/lapis.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "create:lapis_plate" + ], + "optional": [] +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 017a2de3b..f8ba38871 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -51,11 +51,8 @@ import com.simibubi.create.modules.contraptions.relays.advanced.SpeedControllerB import com.simibubi.create.modules.contraptions.relays.advanced.sequencer.SequencedGearshiftBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock; -import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock; import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltBlock; -import com.simibubi.create.modules.contraptions.relays.encased.GearshiftBlock; import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock; -import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxBlock; import com.simibubi.create.modules.curiosities.CocoaLogBlock; import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockBlock; import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock; @@ -124,9 +121,9 @@ public enum AllBlocks implements NonNullSupplier { // COGWHEEL(() -> new CogWheelBlock(false), (b, p) -> new CogwheelBlockItem(b, p, false)), // LARGE_COGWHEEL(() -> new CogWheelBlock(true), (b, p) -> new CogwheelBlockItem(b, p, true)), // ENCASED_SHAFT(EncasedShaftBlock::new), - GEARBOX(GearboxBlock::new), - CLUTCH(ClutchBlock::new), - GEARSHIFT(GearshiftBlock::new), +// GEARBOX(GearboxBlock::new), +// CLUTCH(ClutchBlock::new), +// GEARSHIFT(GearshiftBlock::new), ENCASED_BELT(EncasedBeltBlock::new), ADJUSTABLE_PULLEY(AdjustablePulleyBlock::new), diff --git a/src/main/java/com/simibubi/create/AllBlocksNew.java b/src/main/java/com/simibubi/create/AllBlocksNew.java index 8012ae2d3..601320d54 100644 --- a/src/main/java/com/simibubi/create/AllBlocksNew.java +++ b/src/main/java/com/simibubi/create/AllBlocksNew.java @@ -2,12 +2,16 @@ package com.simibubi.create; import static com.simibubi.create.modules.Sections.SCHEMATICS; +import com.simibubi.create.foundation.utility.data.AssetLookup; import com.simibubi.create.foundation.utility.data.BlockStateGen; import com.simibubi.create.modules.Sections; import com.simibubi.create.modules.contraptions.relays.elementary.CogWheelBlock; import com.simibubi.create.modules.contraptions.relays.elementary.CogwheelBlockItem; import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock; +import com.simibubi.create.modules.contraptions.relays.encased.ClutchBlock; import com.simibubi.create.modules.contraptions.relays.encased.EncasedShaftBlock; +import com.simibubi.create.modules.contraptions.relays.encased.GearshiftBlock; +import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxBlock; import com.simibubi.create.modules.schematics.block.SchematicTableBlock; import com.simibubi.create.modules.schematics.block.SchematicannonBlock; import com.tterrag.registrate.util.entry.BlockEntry; @@ -26,10 +30,10 @@ public class AllBlocksNew { public static final BlockEntry SCHEMATICANNON = REGISTRATE.block("schematicannon", SchematicannonBlock::new) .initialProperties(() -> Blocks.DISPENSER) - .blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), BlockStateGen.partialBaseModel(ctx, prov))) + .blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov))) .item() - .model(BlockStateGen::customItemModel) - .build() + .model(AssetLookup::customItemModel) + .build() .register(); public static final BlockEntry SCHEMATIC_TABLE = @@ -46,36 +50,60 @@ public class AllBlocksNew { public static final BlockEntry SHAFT = REGISTRATE.block("shaft", ShaftBlock::new) .initialProperties(SharedProperties::kinetic) - .blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p))) + .blockstate(BlockStateGen.axisBlockProvider(false)) .simpleItem() .register(); public static final BlockEntry COGWHEEL = REGISTRATE.block("cogwheel", CogWheelBlock::small) .initialProperties(SharedProperties::kinetic) .properties(p -> p.sound(SoundType.WOOD)) - .blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p))) + .blockstate(BlockStateGen.axisBlockProvider(false)) .item(CogwheelBlockItem::new) - .build() + .build() .register(); public static final BlockEntry LARGE_COGWHEEL = REGISTRATE.block("large_cogwheel", CogWheelBlock::large) .initialProperties(SharedProperties::kinetic) .properties(p -> p.sound(SoundType.WOOD)) - .blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.standardModel(c, p))) + .blockstate(BlockStateGen.axisBlockProvider(false)) .item(CogwheelBlockItem::new) - .build() + .build() .register(); public static final BlockEntry ENCASED_SHAFT = REGISTRATE.block("encased_shaft", EncasedShaftBlock::new) .initialProperties(SharedProperties::kinetic) - .blockstate((c, p) -> BlockStateGen.axisKineticBlock(c, p, BlockStateGen.partialBaseModel(c, p))) + .blockstate(BlockStateGen.axisBlockProvider(true)) .item() - .model(BlockStateGen::customItemModel) - .build() + .model(AssetLookup::customItemModel) + .build() .register(); + public static final BlockEntry GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new) + .initialProperties(SharedProperties::kinetic) + .blockstate(BlockStateGen.axisBlockProvider(true)) + .item() + .model(AssetLookup::customItemModel) + .build() + .register(); + + public static final BlockEntry CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new) + .initialProperties(SharedProperties::kinetic) + .blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p))) + .item() + .model(AssetLookup::customItemModel) + .build() + .register(); + + public static final BlockEntry GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new) + .initialProperties(SharedProperties::kinetic) + .blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p))) + .item() + .model(AssetLookup::customItemModel) + .build() + .register(); + public static void register() { } } diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index 311716d36..65c86ab11 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -194,7 +194,7 @@ public enum AllItems { } public static Properties includeInItemGroup() { - return new Properties().group(Create.creativeTab); + return new Properties().group(Create.baseCreativeTab); } public static void register(RegistryEvent.Register event) { diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index d05be667b..3f1cb3231 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -111,14 +111,14 @@ public enum AllTileEntities { // Kinetics SHAFT(ShaftTileEntity::new, AllBlocksNew.SHAFT, AllBlocksNew.COGWHEEL, AllBlocksNew.LARGE_COGWHEEL, AllBlocksNew.ENCASED_SHAFT), MOTOR(MotorTileEntity::new, AllBlocks.CREATIVE_MOTOR), - GEARBOX(GearboxTileEntity::new, AllBlocks.GEARBOX), + GEARBOX(GearboxTileEntity::new, AllBlocksNew.GEARBOX), TURNTABLE(TurntableTileEntity::new, AllBlocks.TURNTABLE), ENCASED_SHAFT(EncasedShaftTileEntity::new, AllBlocksNew.ENCASED_SHAFT, AllBlocks.ENCASED_BELT), ADJUSTABLE_PULLEY(AdjustablePulleyTileEntity::new, AllBlocks.ADJUSTABLE_PULLEY), ENCASED_FAN(EncasedFanTileEntity::new, AllBlocks.ENCASED_FAN), NOZZLE(NozzleTileEntity::new, AllBlocks.NOZZLE), - CLUTCH(ClutchTileEntity::new, AllBlocks.CLUTCH), - GEARSHIFT(GearshiftTileEntity::new, AllBlocks.GEARSHIFT), + CLUTCH(ClutchTileEntity::new, AllBlocksNew.CLUTCH), + GEARSHIFT(GearshiftTileEntity::new, AllBlocksNew.GEARSHIFT), HAND_CRANK(HandCrankTileEntity::new, AllBlocks.HAND_CRANK), CUCKOO_CLOCK(CuckooClockTileEntity::new, AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK), diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index 255e8c0f3..c3c4adcec 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -10,6 +10,7 @@ import com.simibubi.create.foundation.command.ServerLagger; import com.simibubi.create.foundation.world.AllWorldFeatures; import com.simibubi.create.modules.contraptions.TorquePropagator; import com.simibubi.create.modules.logistics.RedstoneLinkNetworkHandler; +import com.simibubi.create.modules.palettes.PalettesItemGroup; import com.simibubi.create.modules.schematics.ServerSchematicLoader; import com.tterrag.registrate.util.NonNullLazyValue; @@ -36,11 +37,14 @@ public class Create { public static final String VERSION = "0.1.1b"; public static Logger logger = LogManager.getLogger(); - public static ItemGroup creativeTab = new CreateItemGroup(); + public static ItemGroup baseCreativeTab = new CreateItemGroup(); + public static ItemGroup palettesCreativeTab = new PalettesItemGroup(); + public static ServerSchematicLoader schematicReceiver; public static RedstoneLinkNetworkHandler redstoneLinkNetworkHandler; public static TorquePropagator torquePropagator; public static ServerLagger lagger; + private static final NonNullLazyValue registrate = CreateRegistrate.lazy(ID); public Create() { diff --git a/src/main/java/com/simibubi/create/CreateItemGroup.java b/src/main/java/com/simibubi/create/CreateItemGroup.java index a9f24a52b..dfa4544da 100644 --- a/src/main/java/com/simibubi/create/CreateItemGroup.java +++ b/src/main/java/com/simibubi/create/CreateItemGroup.java @@ -1,24 +1,27 @@ package com.simibubi.create; -import com.simibubi.create.foundation.item.IAddedByOther; +import com.simibubi.create.modules.Sections; import com.tterrag.registrate.util.entry.RegistryEntry; import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.model.IBakedModel; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.util.NonNullList; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -public final class CreateItemGroup extends ItemGroup { +public class CreateItemGroup extends CreateItemGroupBase { public CreateItemGroup() { - super(getGroupCountSafe(), Create.ID); + super("base"); + } + + @Override + protected boolean shouldAdd(RegistryEntry block) { + Sections section = Create.registrate() + .getSection(block); + return section != Sections.PALETTES; + } + + @Override + protected boolean shouldAdd(AllItems item) { + return item.section != Sections.PALETTES; } @Override @@ -26,43 +29,4 @@ public final class CreateItemGroup extends ItemGroup { return AllBlocksNew.COGWHEEL.asStack(); } - @Override - @OnlyIn(Dist.CLIENT) - public void fill(NonNullList items) { - addItems(items, true); - addBlocks(items); - addItems(items, false); - } - - @OnlyIn(Dist.CLIENT) - public void addBlocks(NonNullList items) { - for (RegistryEntry entry : Create.registrate().getAll(Block.class)) { - Block def = entry.get(); - if (def == null) - continue; - if (def instanceof IAddedByOther) - continue; - - Item item = def.asItem(); - if (item != Items.AIR) - item.fillItemGroup(this, items); - } - } - - @OnlyIn(Dist.CLIENT) - public void addItems(NonNullList items, boolean specialItems) { - ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); - - for (AllItems item : AllItems.values()) { - if (item.get() == null) - continue; - IBakedModel model = itemRenderer.getItemModelWithOverrides(item.asStack(), Minecraft.getInstance().world, null); - if (model.isGui3d() != specialItems) - continue; - if (item.get() instanceof IAddedByOther) - continue; - - item.get().fillItemGroup(this, items); - } - } } diff --git a/src/main/java/com/simibubi/create/CreateItemGroupBase.java b/src/main/java/com/simibubi/create/CreateItemGroupBase.java new file mode 100644 index 000000000..8f4e23797 --- /dev/null +++ b/src/main/java/com/simibubi/create/CreateItemGroupBase.java @@ -0,0 +1,69 @@ +package com.simibubi.create; + +import com.tterrag.registrate.util.entry.RegistryEntry; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.util.NonNullList; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +public abstract class CreateItemGroupBase extends ItemGroup { + + public CreateItemGroupBase(String id) { + super(getGroupCountSafe(), Create.ID + "." + id); + } + + @Override + @OnlyIn(Dist.CLIENT) + public void fill(NonNullList items) { + addItems(items, true); + addBlocks(items); + addItems(items, false); + } + + @OnlyIn(Dist.CLIENT) + public void addBlocks(NonNullList items) { + for (RegistryEntry entry : Create.registrate() + .getAll(Block.class)) { + if (!shouldAdd(entry)) + continue; + Block def = entry.get(); + if (def == null) + continue; + Item item = def.asItem(); + if (item != Items.AIR) + def.fillItemGroup(this, items); + } + } + + protected abstract boolean shouldAdd(RegistryEntry block); + + protected abstract boolean shouldAdd(AllItems item); + + @OnlyIn(Dist.CLIENT) + public void addItems(NonNullList items, boolean specialItems) { + ItemRenderer itemRenderer = Minecraft.getInstance() + .getItemRenderer(); + + for (AllItems item : AllItems.values()) { + if (!shouldAdd(item)) + continue; + if (item.get() == null) + continue; + IBakedModel model = + itemRenderer.getItemModelWithOverrides(item.asStack(), Minecraft.getInstance().world, null); + if (model.isGui3d() != specialItems) + continue; + + item.get() + .fillItemGroup(this, items); + } + } +} diff --git a/src/main/java/com/simibubi/create/CreateRegistrate.java b/src/main/java/com/simibubi/create/CreateRegistrate.java index 51a59d6e4..0638a9ac4 100644 --- a/src/main/java/com/simibubi/create/CreateRegistrate.java +++ b/src/main/java/com/simibubi/create/CreateRegistrate.java @@ -28,7 +28,7 @@ public class CreateRegistrate extends AbstractRegistrate { public static CreateRegistrate create(String modid) { return new CreateRegistrate(modid).registerEventListeners(FMLJavaModLoadingContext.get() .getModEventBus()) - .itemGroup(() -> Create.creativeTab); + .itemGroup(() -> Create.baseCreativeTab); } public static NonNullLazyValue lazy(String modid) { diff --git a/src/main/java/com/simibubi/create/foundation/item/IAddedByOther.java b/src/main/java/com/simibubi/create/foundation/item/IAddedByOther.java deleted file mode 100644 index 41f9ab346..000000000 --- a/src/main/java/com/simibubi/create/foundation/item/IAddedByOther.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.simibubi.create.foundation.item; - -public interface IAddedByOther { - -} diff --git a/src/main/java/com/simibubi/create/foundation/utility/data/AssetLookup.java b/src/main/java/com/simibubi/create/foundation/utility/data/AssetLookup.java new file mode 100644 index 000000000..a0657dcd5 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/utility/data/AssetLookup.java @@ -0,0 +1,58 @@ +package com.simibubi.create.foundation.utility.data; + +import java.util.function.Function; + +import com.tterrag.registrate.providers.DataGenContext; +import com.tterrag.registrate.providers.RegistrateBlockstateProvider; +import com.tterrag.registrate.providers.RegistrateItemModelProvider; + +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraftforge.client.model.generators.ItemModelBuilder; +import net.minecraftforge.client.model.generators.ModelFile; + +public class AssetLookup { + + /** + * Custom block models packaged with other partials. Example: + * models/block/schematicannon/block.json
+ *
+ * Adding "powered", "vertical" will look for /block_powered_vertical.json + */ + public static ModelFile partialBaseModel(DataGenContext ctx, RegistrateBlockstateProvider prov, + String... suffix) { + String string = "/block"; + for (String suf : suffix) + string += "_" + suf; + final String location = "block/" + ctx.getName() + string; + return prov.models() + .getExistingFile(prov.modLoc(location)); + } + + /** + * Custom block model from models/block/x.json + */ + public static ModelFile standardModel(DataGenContext ctx, RegistrateBlockstateProvider prov) { + return prov.models() + .getExistingFile(prov.modLoc("block/" + ctx.getName())); + } + + /** + * Generate item model inheriting from a seperate model in + * models/block/x/item.json + */ + public static ItemModelBuilder customItemModel(DataGenContext ctx, + RegistrateItemModelProvider prov) { + return prov.blockItem(() -> ctx.getEntry() + .getBlock(), "/item"); + } + + public static Function forPowered(DataGenContext ctx, + RegistrateBlockstateProvider prov) { + return state -> state.get(BlockStateProperties.POWERED) ? partialBaseModel(ctx, prov, "powered") + : partialBaseModel(ctx, prov); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/utility/data/BlockStateGen.java b/src/main/java/com/simibubi/create/foundation/utility/data/BlockStateGen.java index a54d5982c..9f8bc4fd2 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/data/BlockStateGen.java +++ b/src/main/java/com/simibubi/create/foundation/utility/data/BlockStateGen.java @@ -1,60 +1,38 @@ package com.simibubi.create.foundation.utility.data; -import com.simibubi.create.modules.contraptions.base.RotatedPillarKineticBlock; +import java.util.function.Function; + import com.tterrag.registrate.providers.DataGenContext; import com.tterrag.registrate.providers.RegistrateBlockstateProvider; -import com.tterrag.registrate.providers.RegistrateItemModelProvider; -import com.tterrag.registrate.util.nullness.NonnullType; +import com.tterrag.registrate.util.nullness.NonNullBiConsumer; import net.minecraft.block.Block; -import net.minecraft.block.RotatedPillarBlock; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; +import net.minecraft.block.BlockState; +import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction.Axis; -import net.minecraftforge.client.model.generators.ItemModelBuilder; -import net.minecraftforge.client.model.generators.ModelFile.ExistingModelFile; -import net.minecraftforge.client.model.generators.VariantBlockStateBuilder; +import net.minecraftforge.client.model.generators.ConfiguredModel; +import net.minecraftforge.client.model.generators.ModelFile; public class BlockStateGen { - /** - * Equivalent to BlockStateProvider#axisBlock without the need for a - * RotatedPillarBlock instance - */ - public static VariantBlockStateBuilder axisKineticBlock( - DataGenContext ctx, RegistrateBlockstateProvider prov, ExistingModelFile model) { - RotatedPillarKineticBlock block = ctx.getEntry(); - return prov.getVariantBuilder(block).partialState().with(RotatedPillarBlock.AXIS, Axis.Y).modelForState() - .modelFile(model).addModel().partialState().with(RotatedPillarBlock.AXIS, Axis.Z).modelForState() - .modelFile(model).rotationX(90).addModel().partialState().with(RotatedPillarBlock.AXIS, Axis.X) - .modelForState().modelFile(model).rotationX(90).rotationY(90).addModel(); + public static NonNullBiConsumer, RegistrateBlockstateProvider> axisBlockProvider( + boolean customItem) { + return (c, p) -> BlockStateGen.axisBlock(c, p, + $ -> customItem ? AssetLookup.partialBaseModel(c, p) : AssetLookup.standardModel(c, p)); } - /** - * Custom block models packaged with other partials. Example: - * models/block/schematicannon/block.json - */ - public static ExistingModelFile partialBaseModel(@NonnullType DataGenContext ctx, - @NonnullType RegistrateBlockstateProvider prov) { - return prov.models().getExistingFile(prov.modLoc("block/" + ctx.getName() + "/block")); - } - - /** - * Custom block model from models/block/x.json - */ - public static ExistingModelFile standardModel(@NonnullType DataGenContext ctx, - @NonnullType RegistrateBlockstateProvider prov) { - return prov.models().getExistingFile(prov.modLoc("block/" + ctx.getName())); - } - - /** - * Generate item model inheriting from a seperate model in - * models/block/x/item.json - */ - public static ItemModelBuilder customItemModel(@NonnullType DataGenContext ctx, - @NonnullType RegistrateItemModelProvider prov) { - return prov.blockItem(() -> ctx.getEntry().getBlock(), "/item"); + public static void axisBlock(DataGenContext ctx, RegistrateBlockstateProvider prov, + Function modelFunc) { + prov.getVariantBuilder(ctx.getEntry()) + .forAllStates(state -> { + Axis axis = state.get(BlockStateProperties.AXIS); + return ConfiguredModel.builder() + .modelFile(modelFunc.apply(state)) + .rotationX(axis == Axis.Y ? 0 : 90) + .rotationY(axis == Axis.X ? 90 : 0) + .build(); + }); } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java index fcf38b909..769ca648c 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java @@ -2,6 +2,7 @@ package com.simibubi.create.modules.contraptions.base; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.simibubi.create.AllBlocksNew; import com.simibubi.create.CreateClient; import com.simibubi.create.foundation.block.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; @@ -15,6 +16,7 @@ import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; import net.minecraftforge.api.distmarker.Dist; @@ -25,23 +27,25 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer KINETIC_TILE = new Compartment<>(); public static boolean rainbowMode = false; - + public KineticTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { super(dispatcher); } - + @Override protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(RenderType.getSolid())); } - public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms, IVertexBuilder buffer) { + public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms, + IVertexBuilder buffer) { SuperByteBuffer superByteBuffer = CreateClient.bufferCache.renderBlockIn(KINETIC_TILE, renderedState); renderRotatingBuffer(te, superByteBuffer, ms, buffer); } - public static void renderRotatingBuffer(KineticTileEntity te, SuperByteBuffer superBuffer, MatrixStack ms, IVertexBuilder buffer) { + public static void renderRotatingBuffer(KineticTileEntity te, SuperByteBuffer superBuffer, MatrixStack ms, + IVertexBuilder buffer) { standardKineticRotationTransform(superBuffer, te).renderInto(ms, buffer); } @@ -54,13 +58,15 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer } protected BlockState getRenderedBlockState(KineticTileEntity te) { - BlockState state = te.getBlockState(); - return AllBlocksNew.SHAFT.getDefaultState().with(AXIS, ((IRotate) state.getBlock()).getRotationAxis(state)); + return KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te)); } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerRenderer.java index fb1eec01e..28487ef8e 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/advanced/SpeedControllerRenderer.java @@ -1,14 +1,11 @@ package com.simibubi.create.modules.contraptions.relays.advanced; import com.mojang.blaze3d.matrix.MatrixStack; -import com.simibubi.create.AllBlocksNew; import com.simibubi.create.CreateClient; import com.simibubi.create.foundation.behaviour.base.SmartTileEntityRenderer; import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; -import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock; -import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; @@ -18,19 +15,19 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer p_149666_2_) { + p_149666_2_.add(AllItems.BELT_CONNECTOR.asStack()); + } + @Override public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) { if (face.getAxis() != getRotationAxis(state)) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/item/BeltConnectorItem.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/item/BeltConnectorItem.java index cecc06822..b768a156b 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/item/BeltConnectorItem.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/belt/item/BeltConnectorItem.java @@ -4,9 +4,9 @@ import java.util.LinkedList; import java.util.List; import com.simibubi.create.AllBlocks; +import com.simibubi.create.Create; import com.simibubi.create.config.AllConfigs; import com.simibubi.create.foundation.advancement.AllTriggers; -import com.simibubi.create.foundation.item.IAddedByOther; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock; import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock.Part; @@ -15,6 +15,8 @@ import com.simibubi.create.modules.contraptions.relays.elementary.ShaftBlock; import net.minecraft.block.BlockState; import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTUtil; @@ -24,10 +26,11 @@ import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.AxisDirection; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class BeltConnectorItem extends BlockItem implements IAddedByOther { +public class BeltConnectorItem extends BlockItem { public BeltConnectorItem(Properties properties) { super(AllBlocks.BELT.get(), properties); @@ -38,10 +41,19 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { return getDefaultTranslationKey(); } + @Override + public void fillItemGroup(ItemGroup p_150895_1_, NonNullList p_150895_2_) { + if (p_150895_1_ == Create.baseCreativeTab) + return; + super.fillItemGroup(p_150895_1_, p_150895_2_); + } + @Override public ActionResultType onItemUse(ItemUseContext context) { - if (context.getPlayer().isSneaking()) { - context.getItem().setTag(null); + if (context.getPlayer() + .isSneaking()) { + context.getItem() + .setTag(null); return ActionResultType.SUCCESS; } @@ -52,7 +64,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { if (world.isRemote) return validAxis ? ActionResultType.SUCCESS : ActionResultType.FAIL; - CompoundNBT tag = context.getItem().getOrCreateTag(); + CompoundNBT tag = context.getItem() + .getOrCreateTag(); BlockPos firstPulley = null; // Remove first if no longer existant or valid @@ -60,7 +73,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { firstPulley = NBTUtil.readBlockPos(tag.getCompound("FirstPulley")); if (!validateAxis(world, firstPulley)) { tag.remove("FirstPulley"); - context.getItem().setTag(tag); + context.getItem() + .setTag(tag); } } @@ -75,20 +89,29 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { if (firstPulley != null && !firstPulley.equals(pos) && !world.isRemote) { createBelts(world, firstPulley, pos); AllTriggers.triggerFor(AllTriggers.CONNECT_BELT, context.getPlayer()); - if (!context.getPlayer().isCreative()) - context.getItem().shrink(1); + if (!context.getPlayer() + .isCreative()) + context.getItem() + .shrink(1); } - if (!context.getItem().isEmpty()) { - context.getItem().setTag(null); - context.getPlayer().getCooldownTracker().setCooldown(this, 5); + if (!context.getItem() + .isEmpty()) { + context.getItem() + .setTag(null); + context.getPlayer() + .getCooldownTracker() + .setCooldown(this, 5); } return ActionResultType.SUCCESS; } tag.put("FirstPulley", NBTUtil.writeBlockPos(pos)); - context.getItem().setTag(tag); - context.getPlayer().getCooldownTracker().setCooldown(this, 5); + context.getItem() + .setTag(tag); + context.getPlayer() + .getCooldownTracker() + .setCooldown(this, 5); return ActionResultType.SUCCESS; } @@ -99,25 +122,21 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { BlockPos diff = end.subtract(start); if (diff.getX() == diff.getZ()) - facing = Direction - .getFacingFromAxis(facing.getAxisDirection(), - world.getBlockState(start).get(BlockStateProperties.AXIS) == Axis.X ? Axis.Z : Axis.X); + facing = Direction.getFacingFromAxis(facing.getAxisDirection(), world.getBlockState(start) + .get(BlockStateProperties.AXIS) == Axis.X ? Axis.Z : Axis.X); List beltsToCreate = getBeltChainBetween(start, end, slope, facing); - BlockState beltBlock = AllBlocks.BELT.get().getDefaultState(); + BlockState beltBlock = AllBlocks.BELT.get() + .getDefaultState(); for (BlockPos pos : beltsToCreate) { BeltBlock.Part part = pos.equals(start) ? Part.START : pos.equals(end) ? Part.END : Part.MIDDLE; boolean pulley = ShaftBlock.isShaft(world.getBlockState(pos)); if (part == Part.MIDDLE && pulley) part = Part.PULLEY; - world - .setBlockState(pos, - beltBlock - .with(BeltBlock.SLOPE, slope) - .with(BeltBlock.PART, part) - .with(BeltBlock.HORIZONTAL_FACING, facing), - 3); + world.setBlockState(pos, beltBlock.with(BeltBlock.SLOPE, slope) + .with(BeltBlock.PART, part) + .with(BeltBlock.HORIZONTAL_FACING, facing), 3); } } @@ -178,7 +197,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { return false; BlockPos diff = second.subtract(first); - Axis axis = world.getBlockState(first).get(BlockStateProperties.AXIS); + Axis axis = world.getBlockState(first) + .get(BlockStateProperties.AXIS); int x = diff.getX(); int y = diff.getY(); @@ -190,7 +210,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { return false; if (sames != 1) return false; - if (axis != world.getBlockState(second).get(BlockStateProperties.AXIS)) + if (axis != world.getBlockState(second) + .get(BlockStateProperties.AXIS)) return false; TileEntity tileEntity = world.getTileEntity(first); @@ -213,7 +234,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { BlockState blockState = world.getBlockState(currentPos); if (ShaftBlock.isShaft(blockState) && blockState.get(ShaftBlock.AXIS) == axis) continue; - if (!blockState.getMaterial().isReplaceable()) + if (!blockState.getMaterial() + .isReplaceable()) return false; } @@ -226,7 +248,8 @@ public class BeltConnectorItem extends BlockItem implements IAddedByOther { return false; if (!ShaftBlock.isShaft(world.getBlockState(pos))) return false; - if (world.getBlockState(pos).get(BlockStateProperties.AXIS) == Axis.Y) + if (world.getBlockState(pos) + .get(BlockStateProperties.AXIS) == Axis.Y) return false; return true; } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/ClutchBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/ClutchBlock.java index 07e9a48e8..79d94daa2 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/ClutchBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/ClutchBlock.java @@ -9,6 +9,10 @@ import net.minecraft.world.World; public class ClutchBlock extends GearshiftBlock { + public ClutchBlock(Properties properties) { + super(properties); + } + @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new ClutchTileEntity(); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/EncasedShaftTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/EncasedShaftTileEntityRenderer.java index f84638507..5bcb3ba6f 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/EncasedShaftTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/EncasedShaftTileEntityRenderer.java @@ -1,12 +1,10 @@ package com.simibubi.create.modules.contraptions.relays.encased; -import com.simibubi.create.AllBlocksNew; import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.state.properties.BlockStateProperties; public class EncasedShaftTileEntityRenderer extends KineticTileEntityRenderer { @@ -16,8 +14,7 @@ public class EncasedShaftTileEntityRenderer extends KineticTileEntityRenderer { @Override protected BlockState getRenderedBlockState(KineticTileEntity te) { - return AllBlocksNew.SHAFT.getDefaultState().with(BlockStateProperties.AXIS, - te.getBlockState().get(BlockStateProperties.AXIS)); + return shaft(getRotationAxisOf(te)); } } diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/GearshiftBlock.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/GearshiftBlock.java index a0acd3d04..e6fc40074 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/GearshiftBlock.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/encased/GearshiftBlock.java @@ -9,7 +9,6 @@ import com.simibubi.create.modules.contraptions.relays.gearbox.GearshiftTileEnti import net.minecraft.block.Block; import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.BooleanProperty; import net.minecraft.state.StateContainer.Builder; @@ -27,8 +26,8 @@ public class GearshiftBlock extends EncasedShaftBlock implements ITE items) { super.fillItemGroup(group, items); - items.add(new ItemStack(AllItems.VERTICAL_GEARBOX.get())); + items.add(AllItems.VERTICAL_GEARBOX.asStack()); } @SuppressWarnings("deprecation") diff --git a/src/main/java/com/simibubi/create/modules/contraptions/relays/gearbox/VerticalGearboxItem.java b/src/main/java/com/simibubi/create/modules/contraptions/relays/gearbox/VerticalGearboxItem.java index 67b24f87f..4bf626797 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/relays/gearbox/VerticalGearboxItem.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/relays/gearbox/VerticalGearboxItem.java @@ -1,30 +1,44 @@ package com.simibubi.create.modules.contraptions.relays.gearbox; -import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.item.IAddedByOther; +import java.util.Map; + +import com.simibubi.create.AllBlocksNew; import com.simibubi.create.modules.contraptions.base.IRotate; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public class VerticalGearboxItem extends BlockItem implements IAddedByOther { +public class VerticalGearboxItem extends BlockItem { public VerticalGearboxItem(Properties builder) { - super(AllBlocks.GEARBOX.get(), builder); + super(AllBlocksNew.GEARBOX.get(), builder); + } + + @Override + public void fillItemGroup(ItemGroup p_150895_1_, NonNullList p_150895_2_) { + } + + @Override + public void addToBlockToItemMap(Map p_195946_1_, Item p_195946_2_) { } @Override protected boolean onBlockPlaced(BlockPos pos, World world, PlayerEntity player, ItemStack stack, BlockState state) { Axis prefferedAxis = null; for (Direction side : Direction.values()) { - if (side.getAxis().isVertical()) + if (side.getAxis() + .isVertical()) continue; BlockState blockState = world.getBlockState(pos.offset(side)); if (blockState.getBlock() instanceof IRotate) { @@ -39,8 +53,9 @@ public class VerticalGearboxItem extends BlockItem implements IAddedByOther { } } - Axis axis = prefferedAxis == null ? player.getHorizontalFacing().rotateY().getAxis() - : prefferedAxis == Axis.X ? Axis.Z : Axis.X; + Axis axis = prefferedAxis == null ? player.getHorizontalFacing() + .rotateY() + .getAxis() : prefferedAxis == Axis.X ? Axis.Z : Axis.X; world.setBlockState(pos, state.with(BlockStateProperties.AXIS, axis)); return super.onBlockPlaced(pos, world, player, stack, state); } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItem.java b/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItem.java index 5cc8cd05a..585d473ce 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/zapper/blockzapper/BlockzapperItem.java @@ -77,7 +77,7 @@ public class BlockzapperItem extends ZapperItem implements IHaveCustomItemModel @Override public void fillItemGroup(ItemGroup group, NonNullList items) { - if (group == Create.creativeTab) { + if (group == Create.baseCreativeTab) { ItemStack gunWithoutStuff = new ItemStack(this); items.add(gunWithoutStuff); diff --git a/src/main/java/com/simibubi/create/modules/palettes/PalettesItemGroup.java b/src/main/java/com/simibubi/create/modules/palettes/PalettesItemGroup.java new file mode 100644 index 000000000..cdcfcbd90 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/palettes/PalettesItemGroup.java @@ -0,0 +1,37 @@ +package com.simibubi.create.modules.palettes; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllItems; +import com.simibubi.create.Create; +import com.simibubi.create.CreateItemGroupBase; +import com.simibubi.create.modules.Sections; +import com.tterrag.registrate.util.entry.RegistryEntry; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +public class PalettesItemGroup extends CreateItemGroupBase { + + public PalettesItemGroup() { + super("palettes"); + } + + @Override + protected boolean shouldAdd(RegistryEntry block) { + Sections section = Create.registrate() + .getSection(block); + return section == Sections.PALETTES; + } + + @Override + protected boolean shouldAdd(AllItems item) { + return item.section == Sections.PALETTES; + } + + @Override + public ItemStack createIcon() { + return new ItemStack(AllBlocks.IRON_GLASS.get()); + } + + +} diff --git a/src/main/resources/assets/create/blockstates/clutch.json b/src/main/resources/assets/create/blockstates/clutch.json deleted file mode 100644 index 68465673e..000000000 --- a/src/main/resources/assets/create/blockstates/clutch.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "variants": { - "powered=true,axis=x": { "model": "create:block/clutch_on", "y": 90 }, - "powered=true,axis=y": { "model": "create:block/clutch_on", "x": 90 }, - "powered=true,axis=z": { "model": "create:block/clutch_on" }, - "powered=false,axis=x": { "model": "create:block/clutch_off", "y": 90 }, - "powered=false,axis=y": { "model": "create:block/clutch_off", "x": 90 }, - "powered=false,axis=z": { "model": "create:block/clutch_off" } - } -} diff --git a/src/main/resources/assets/create/blockstates/gearbox.json b/src/main/resources/assets/create/blockstates/gearbox.json deleted file mode 100644 index 912915654..000000000 --- a/src/main/resources/assets/create/blockstates/gearbox.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "variants": { - "axis=y": { "model": "create:block/gearbox" }, - "axis=z": { "model": "create:block/gearbox", "x": 90 }, - "axis=x": { "model": "create:block/gearbox", "x": 90, "y": 90 } - } -} diff --git a/src/main/resources/assets/create/blockstates/gearshift.json b/src/main/resources/assets/create/blockstates/gearshift.json deleted file mode 100644 index 08d484215..000000000 --- a/src/main/resources/assets/create/blockstates/gearshift.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "variants": { - "powered=true,axis=x": { "model": "create:block/gearshift_on", "y": 90 }, - "powered=true,axis=y": { "model": "create:block/gearshift_on", "x": 90 }, - "powered=true,axis=z": { "model": "create:block/gearshift_on" }, - "powered=false,axis=x": { "model": "create:block/gearshift_off", "y": 90 }, - "powered=false,axis=y": { "model": "create:block/gearshift_off", "x": 90 }, - "powered=false,axis=z": { "model": "create:block/gearshift_off" } - } -} diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index d9bdd07d8..9adfa7b8e 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -1221,5 +1221,6 @@ "tool.create.rose_quartz.tooltip": "ROSE QUARTZ TOOLS", "tool.create.rose_quartz.tooltip.summary": "This tool grants you a _greater_ _reach_ for _breaking_ _blocks_ or _placing_ _blocks_ from the off-hand.", - "itemGroup.create": "Create" + "itemGroup.create.base": "Create", + "itemGroup.create.palettes": "Create Palettes" } diff --git a/src/main/resources/assets/create/models/block/clutch_off.json b/src/main/resources/assets/create/models/block/clutch/block.json similarity index 71% rename from src/main/resources/assets/create/models/block/clutch_off.json rename to src/main/resources/assets/create/models/block/clutch/block.json index 8e4ab3138..09b9f4215 100644 --- a/src/main/resources/assets/create/models/block/clutch_off.json +++ b/src/main/resources/assets/create/models/block/clutch/block.json @@ -1,5 +1,5 @@ { - "parent": "create:block/gearshift_off", + "parent": "create:block/gearshift/block", "textures": { "0": "create:block/clutch_off", "particle": "create:block/clutch_off" diff --git a/src/main/resources/assets/create/models/block/clutch_on.json b/src/main/resources/assets/create/models/block/clutch/block_powered.json similarity index 71% rename from src/main/resources/assets/create/models/block/clutch_on.json rename to src/main/resources/assets/create/models/block/clutch/block_powered.json index da96aacb3..1f014b711 100644 --- a/src/main/resources/assets/create/models/block/clutch_on.json +++ b/src/main/resources/assets/create/models/block/clutch/block_powered.json @@ -1,5 +1,5 @@ { - "parent": "create:block/gearshift_off", + "parent": "create:block/clutch/block", "textures": { "0": "create:block/clutch_on", "particle": "create:block/clutch_on" diff --git a/src/main/resources/assets/create/models/item/clutch.json b/src/main/resources/assets/create/models/block/clutch/item.json similarity index 100% rename from src/main/resources/assets/create/models/item/clutch.json rename to src/main/resources/assets/create/models/block/clutch/item.json diff --git a/src/main/resources/assets/create/models/block/gearbox.json b/src/main/resources/assets/create/models/block/gearbox/block.json similarity index 100% rename from src/main/resources/assets/create/models/block/gearbox.json rename to src/main/resources/assets/create/models/block/gearbox/block.json diff --git a/src/main/resources/assets/create/models/item/gearbox.json b/src/main/resources/assets/create/models/block/gearbox/item.json similarity index 100% rename from src/main/resources/assets/create/models/item/gearbox.json rename to src/main/resources/assets/create/models/block/gearbox/item.json diff --git a/src/main/resources/assets/create/models/block/gearshift/block.json b/src/main/resources/assets/create/models/block/gearshift/block.json new file mode 100644 index 000000000..1189b38c5 --- /dev/null +++ b/src/main/resources/assets/create/models/block/gearshift/block.json @@ -0,0 +1,68 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "create:block/gearshift_off", + "1": "create:block/gearbox", + "particle": "create:block/gearshift_off" + }, + "elements": [ + { + "name": "Bottom", + "from": [0, 0, 0], + "to": [16, 16, 2], + "faces": { + "north": {"uv": [0, 0, 16, 16], "rotation": 90, "texture": "#0"}, + "east": {"uv": [0, 14, 16, 16], "rotation": 270, "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 14, 16, 16], "rotation": 90, "texture": "#0"}, + "up": {"uv": [0, 14, 16, 16], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 14, 16, 16], "texture": "#0"} + } + }, + { + "name": "Core", + "from": [1, 1, 2], + "to": [15, 15, 14], + "faces": { + "up": {"uv": [1, 2, 15, 14], "rotation": 180, "texture": "#1"}, + "down": {"uv": [1, 2, 15, 14], "texture": "#1"} + } + }, + { + "name": "Top", + "from": [0, 0, 14], + "to": [16, 16, 16], + "faces": { + "north": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#0"}, + "east": {"uv": [0, 0, 16, 2], "rotation": 270, "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "rotation": 90, "texture": "#0"}, + "west": {"uv": [0, 0, 16, 2], "rotation": 90, "texture": "#0"}, + "up": {"uv": [0, 0, 16, 2], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 0, 16, 2], "texture": "#0"} + } + }, + { + "name": "SideWest", + "from": [0, 0, 2], + "to": [2, 16, 14], + "faces": { + "east": {"uv": [0, 2, 16, 14], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 2, 16, 14], "rotation": 90, "texture": "#0"}, + "up": {"uv": [14, 2, 16, 14], "rotation": 180, "texture": "#0"}, + "down": {"uv": [0, 2, 2, 14], "texture": "#0"} + } + }, + { + "name": "SideEast", + "from": [14, 0, 2], + "to": [16, 16, 14], + "faces": { + "east": {"uv": [0, 2, 16, 14], "rotation": 270, "texture": "#0"}, + "west": {"uv": [0, 2, 16, 14], "rotation": 90, "texture": "#0"}, + "up": {"uv": [0, 2, 2, 14], "rotation": 180, "texture": "#0"}, + "down": {"uv": [14, 2, 16, 14], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/gearshift_on.json b/src/main/resources/assets/create/models/block/gearshift/block_powered.json similarity index 72% rename from src/main/resources/assets/create/models/block/gearshift_on.json rename to src/main/resources/assets/create/models/block/gearshift/block_powered.json index dd6c3b2e1..c8d00afe2 100644 --- a/src/main/resources/assets/create/models/block/gearshift_on.json +++ b/src/main/resources/assets/create/models/block/gearshift/block_powered.json @@ -1,5 +1,5 @@ { - "parent": "create:block/gearshift_off", + "parent": "create:block/gearshift/block", "textures": { "0": "create:block/gearshift_on", "particle": "create:block/gearshift_on" diff --git a/src/main/resources/assets/create/models/item/gearshift.json b/src/main/resources/assets/create/models/block/gearshift/item.json similarity index 100% rename from src/main/resources/assets/create/models/item/gearshift.json rename to src/main/resources/assets/create/models/block/gearshift/item.json diff --git a/src/main/resources/assets/create/models/block/gearshift_off.json b/src/main/resources/assets/create/models/block/gearshift_off.json deleted file mode 100644 index 0b48bdd71..000000000 --- a/src/main/resources/assets/create/models/block/gearshift_off.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", - "parent": "block/block", - "textures": { - "0": "create:block/gearshift_off", - "1": "create:block/gearbox", - "particle": "create:block/gearshift_off" - }, - "elements": [ - { - "name": "Bottom", - "from": [ 0.0, 0.0, 0.0 ], - "to": [ 16.0, 2.0, 16.0 ], - "faces": { - "north": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, - "east": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, - "south": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, - "west": { "texture": "#0", "uv": [ 0.0, 14.0, 16.0, 16.0 ] }, - "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }, - "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ], "rotation": 270 } - } - }, - { - "name": "Core", - "from": [ 1.0, 2.0, 1.0 ], - "to": [ 15.0, 14.0, 15.0 ], - "faces": { - "north": { "texture": "#1", "uv": [ 1.0, 2.0, 15.0, 14.0 ] }, - "south": { "texture": "#1", "uv": [ 1.0, 2.0, 15.0, 14.0 ] } - } - }, - { - "name": "Top", - "from": [ 0.0, 14.0, 0.0 ], - "to": [ 16.0, 16.0, 16.0 ], - "faces": { - "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, - "east": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, - "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, - "west": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 2.0 ] }, - "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ], "rotation": 90 }, - "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] } - } - }, - { - "name": "SideWest", - "from": [ 0.0, 2.0, 0.0 ], - "to": [ 2.0, 14.0, 16.0 ], - "faces": { - "north": { "texture": "#0", "uv": [ 14.0, 2.0, 16.0, 14.0 ] }, - "east": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] }, - "south": { "texture": "#0", "uv": [ 0.0, 2.0, 2.0, 14.0 ] }, - "west": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] } - } - }, - { - "name": "SideEast", - "from": [ 14.0, 2.0, 0.0 ], - "to": [ 16.0, 14.0, 16.0 ], - "faces": { - "north": { "texture": "#0", "uv": [ 0.0, 2.0, 2.0, 14.0 ] }, - "east": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] }, - "south": { "texture": "#0", "uv": [ 14.0, 2.0, 16.0, 14.0 ] }, - "west": { "texture": "#0", "uv": [ 0.0, 2.0, 16.0, 14.0 ] } - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/data/create/recipes/stonecutting/polished_dark_scoria.json b/src/main/resources/data/create/recipes/stonecutting/polished_dark_scoria.json index 36ac32453..e5d28b158 100644 --- a/src/main/resources/data/create/recipes/stonecutting/polished_dark_scoria.json +++ b/src/main/resources/data/create/recipes/stonecutting/polished_dark_scoria.json @@ -4,11 +4,5 @@ "item": "create:dark_scoria" }, "result": "create:polished_dark_scoria", - "count": 1, - "conditions": [ - { - "type": "create:module", - "module": "palettes" - } - ] + "count": 1 } \ No newline at end of file