From ccae111ec8863154085b4db280be76d330289396 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Mon, 30 Nov 2020 15:23:37 +0100 Subject: [PATCH] Reversing the reversed - Controller rails can now control furnace minecarts - Controller rails now snap to adjacent rails with the correct facing - Controller rails no longer get reversed when transitioning to or from a slope in certain orientations - Controller rails are now craftable - Fun refactors - Updated texture - Recipe adjustments --- src/generated/resources/.cache/cache | 13 +- .../create/blockstates/controller_rail.json | 14 +- .../assets/create/blockstates/fluid_pipe.json | 22 +- .../create/models/item/controller_rail.json | 2 +- .../crafting/kinetics/controller_rail.json | 32 +++ .../recipes/crafting/kinetics/chute.json | 3 +- .../crafting/kinetics/controller_rail.json | 23 ++ .../create/recipes/crushing/diamond_ore.json | 23 ++ .../java/com/simibubi/create/AllBlocks.java | 96 +++++-- .../tracks/ControllerRailBlock.java | 265 ++++++++++-------- .../tracks/ControllerRailGenerator.java | 55 ++++ .../create/foundation/data/BlockStateGen.java | 60 +--- .../foundation/data/SpecialBlockStateGen.java | 9 +- .../data/recipe/CrushingRecipeGen.java | 5 + .../data/recipe/StandardRecipeGen.java | 10 + .../create/foundation/utility/Iterate.java | 4 + .../textures/block/controller_rail_analog.png | Bin 336 -> 0 bytes .../textures/block/controller_rail_base.png | Bin 2410 -> 680 bytes .../textures/block/controller_rail_item.png | Bin 0 -> 328 bytes .../textures/block/controller_rail_off.png | Bin 331 -> 0 bytes .../textures/block/controller_rail_on.png | Bin 342 -> 0 bytes .../textures/block/controller_rail_tint.png | Bin 985 -> 585 bytes 22 files changed, 416 insertions(+), 220 deletions(-) create mode 100644 src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/controller_rail.json create mode 100644 src/generated/resources/data/create/recipes/crafting/kinetics/controller_rail.json create mode 100644 src/generated/resources/data/create/recipes/crushing/diamond_ore.json create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailGenerator.java delete mode 100644 src/main/resources/assets/create/textures/block/controller_rail_analog.png create mode 100644 src/main/resources/assets/create/textures/block/controller_rail_item.png delete mode 100644 src/main/resources/assets/create/textures/block/controller_rail_off.png delete mode 100644 src/main/resources/assets/create/textures/block/controller_rail_on.png diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index f9e5a9e74..2b1a99375 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -49,7 +49,7 @@ b59324f051f21d8ce1a48a08f4721a61a3c414d6 assets/create/blockstates/chute.json 1f33834c685e3243882acfe20183fe64dfa872be assets/create/blockstates/clutch.json e5e3757e99c139d67b2a70288466d8a74d818841 assets/create/blockstates/cogwheel.json 36f54136a7756c97f71bc6b47ef4e8e575e72879 assets/create/blockstates/content_observer.json -41b173dd97b3006478796ff356f6ac15f3dfa980 assets/create/blockstates/controller_rail.json +cfea7283f0ebd2432d67e80a523f2a12e24c0bd5 assets/create/blockstates/controller_rail.json f8eff64c75fc599e9a44a003f54ae9931cd8ce7c assets/create/blockstates/copper_block.json cabf6b8c59eb0e3d56a0a5a856ca058bb3200882 assets/create/blockstates/copper_casing.json 3355a852cdc717e257ca19b3db836068964733e3 assets/create/blockstates/copper_ore.json @@ -138,7 +138,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_ fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json 6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json -7335a938fa5e80060cad2ed987afa123debb3998 assets/create/blockstates/fluid_pipe.json +fe9169716dd21a81a3710a89f0a9b7ea4dcd4d51 assets/create/blockstates/fluid_pipe.json f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json 5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json @@ -332,7 +332,7 @@ e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggl d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json 92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json 61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json -6fa36883e76e9e403bb429c8f86b8c0d3bba0cff assets/create/blockstates/radial_chassis.json +8d7e653bfd9846e684a0d3725595714a19201017 assets/create/blockstates/radial_chassis.json 45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json 722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json @@ -1158,7 +1158,7 @@ c1da21be9f1af4f7a2ef4ec9cd92195d65ada316 assets/create/models/item/clockwork_bea 0a2a0f0aafeab0088172f77afd40c1fa2cc1f2b8 assets/create/models/item/clutch.json dcb09deae110077bcddf090996b51cc66e9a7de3 assets/create/models/item/cogwheel.json 7717e3b21cff39f497f07687c70c1fa40eaa756d assets/create/models/item/content_observer.json -17a8889e54d6e82fd1a6eec9e87c46feba903cb1 assets/create/models/item/controller_rail.json +d6e8de74773f89c228d94d6da8cdd8fb8b8545e4 assets/create/models/item/controller_rail.json 965a90a882d85dba93b30af9bce7ecf8e68ce747 assets/create/models/item/copper_block.json 759bcb5fe7dfdd628716f9b4ff19a5ab00393381 assets/create/models/item/copper_casing.json c5bcfba46f5824654dedaa2c5d5f42deb29e3baf assets/create/models/item/copper_ingot.json @@ -1591,6 +1591,7 @@ d3ca638ffbca177b4970f046f6c42770e757e33e data/create/advancements/recipes/create a49a70403523bc9d4eadffdac5507806aca9fd9d data/create/advancements/recipes/create.base/crafting/kinetics/clockwork_bearing.json 403fd0da8ee42a52234e544cf532e454fb80137b data/create/advancements/recipes/create.base/crafting/kinetics/clutch.json 5bbaac432fce5435c8c3df56ec81d31a0b76a4ee data/create/advancements/recipes/create.base/crafting/kinetics/cogwheel.json +b42213bffce4e51618e1bba481959208d247c120 data/create/advancements/recipes/create.base/crafting/kinetics/controller_rail.json 27930edef02aac6e74bfab62128688ecfb575008 data/create/advancements/recipes/create.base/crafting/kinetics/copper_valve_handle.json 512e4d45657f6df3df2639040e8c5e76f9119f17 data/create/advancements/recipes/create.base/crafting/kinetics/copper_valve_handle_from_others.json 7b80f6b25e1e21e9545120592bc1a3561ee49603 data/create/advancements/recipes/create.base/crafting/kinetics/crafter_slot_cover.json @@ -2601,10 +2602,11 @@ c50077a130bc43cd3659faa02ce95789399478b2 data/create/recipes/crafting/kinetics/b a3c99b38fc8896c9971a5e9dcbae747786ff610d data/create/recipes/crafting/kinetics/brown_seat_from_other_seat.json 43233c87cfb80d57345a561c3dd2646c8d3c0d8a data/create/recipes/crafting/kinetics/brown_valve_handle_from_other_valve_handle.json 860796dce8756c4cd234f18bbe52108f3b2254c2 data/create/recipes/crafting/kinetics/cart_assembler.json -3bc3510b64e576d68b19f4ceb5d9bd6591dbcf6c data/create/recipes/crafting/kinetics/chute.json +abf8a28b4b8ae4ba15beed938736ef3a5a7b27ff data/create/recipes/crafting/kinetics/chute.json a80e3eabbeba2931d0d58dd9492018a0d78da8b5 data/create/recipes/crafting/kinetics/clockwork_bearing.json 501ad764d087b40ce36f3d4256b0d5ee25b2081e data/create/recipes/crafting/kinetics/clutch.json e46bcc6778ff5118252fe6371ef817ae1302253a data/create/recipes/crafting/kinetics/cogwheel.json +11fe2ccc11f470e5735c3e848a944f889697ff73 data/create/recipes/crafting/kinetics/controller_rail.json 3093be508f6597eee2f3230cd9072f12d2821a6f data/create/recipes/crafting/kinetics/copper_valve_handle.json 886caa21481e62d44d70fd103f8d29f9bac64d60 data/create/recipes/crafting/kinetics/copper_valve_handle_from_others.json 59db5170cec390fe6c20a27d6154deebe044580c data/create/recipes/crafting/kinetics/crafter_slot_cover.json @@ -2760,6 +2762,7 @@ b83ef0af844ca068e0353330b8273bace5b6a8c3 data/create/recipes/crushing/coal_ore.j da4ed79975391ec9f263869936b84474f1f727d3 data/create/recipes/crushing/copper_block.json d49472887067c871943de1b80887b169682eeca9 data/create/recipes/crushing/copper_ore.json 4c482db5575b74b4111800602d7fce22b2e6d32a data/create/recipes/crushing/diamond_horse_armor.json +28ba8cf655bd11bb6c600cd862b98349c812915f data/create/recipes/crushing/diamond_ore.json e1bb927c62c59f5bf5063bd110da9231de378a1f data/create/recipes/crushing/emerald_ore.json b26b1f0dccf2ffb194ce12173890a83e93369b39 data/create/recipes/crushing/glowstone.json 50e75cdde6996c47b5dc25f27b84367040249107 data/create/recipes/crushing/gold_ore.json diff --git a/src/generated/resources/assets/create/blockstates/controller_rail.json b/src/generated/resources/assets/create/blockstates/controller_rail.json index e09dd08ba..033305478 100644 --- a/src/generated/resources/assets/create/blockstates/controller_rail.json +++ b/src/generated/resources/assets/create/blockstates/controller_rail.json @@ -16,13 +16,13 @@ "y": 90 }, "backwards=false,shape=ascending_east": { - "model": "create:block/controller_rail/block_ascending_north", - "y": 90 - }, - "backwards=true,shape=ascending_east": { "model": "create:block/controller_rail/block_ascending_south", "y": 270 }, + "backwards=true,shape=ascending_east": { + "model": "create:block/controller_rail/block_ascending_north", + "y": 90 + }, "backwards=false,shape=ascending_west": { "model": "create:block/controller_rail/block_ascending_north", "y": 270 @@ -39,11 +39,11 @@ "y": 180 }, "backwards=false,shape=ascending_south": { - "model": "create:block/controller_rail/block_ascending_north", - "y": 180 + "model": "create:block/controller_rail/block_ascending_south" }, "backwards=true,shape=ascending_south": { - "model": "create:block/controller_rail/block_ascending_south" + "model": "create:block/controller_rail/block_ascending_north", + "y": 180 } } } \ No newline at end of file diff --git a/src/generated/resources/assets/create/blockstates/fluid_pipe.json b/src/generated/resources/assets/create/blockstates/fluid_pipe.json index a4cffcde7..3b646b920 100644 --- a/src/generated/resources/assets/create/blockstates/fluid_pipe.json +++ b/src/generated/resources/assets/create/blockstates/fluid_pipe.json @@ -303,8 +303,8 @@ { "when": { "west": "false", - "down": "false", "east": "true", + "down": "false", "up": "true" }, "apply": { @@ -314,8 +314,8 @@ { "when": { "west": "true", - "down": "false", "east": "false", + "down": "false", "up": "true" }, "apply": { @@ -325,8 +325,8 @@ { "when": { "west": "false", - "down": "true", "east": "true", + "down": "true", "up": "false" }, "apply": { @@ -336,8 +336,8 @@ { "when": { "west": "true", - "down": "true", "east": "false", + "down": "true", "up": "false" }, "apply": { @@ -347,8 +347,8 @@ { "when": { "west": "false", - "down": "true", "east": "false", + "down": "true", "up": "true" }, "apply": { @@ -358,8 +358,8 @@ { "when": { "west": "false", - "down": "false", "east": "false", + "down": "false", "up": "true" }, "apply": { @@ -369,8 +369,8 @@ { "when": { "west": "false", - "down": "true", "east": "false", + "down": "true", "up": "false" }, "apply": { @@ -380,8 +380,8 @@ { "when": { "west": "true", - "down": "false", "east": "true", + "down": "false", "up": "false" }, "apply": { @@ -391,8 +391,8 @@ { "when": { "west": "false", - "down": "false", "east": "true", + "down": "false", "up": "false" }, "apply": { @@ -402,8 +402,8 @@ { "when": { "west": "true", - "down": "false", "east": "false", + "down": "false", "up": "false" }, "apply": { @@ -413,8 +413,8 @@ { "when": { "west": "false", - "down": "false", "east": "false", + "down": "false", "up": "false" }, "apply": { diff --git a/src/generated/resources/assets/create/models/item/controller_rail.json b/src/generated/resources/assets/create/models/item/controller_rail.json index 3524bff1a..d224fa651 100644 --- a/src/generated/resources/assets/create/models/item/controller_rail.json +++ b/src/generated/resources/assets/create/models/item/controller_rail.json @@ -1,6 +1,6 @@ { "parent": "item/generated", "textures": { - "layer0": "create:block/controller_rail_analog" + "layer0": "create:block/controller_rail_item" } } \ No newline at end of file diff --git a/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/controller_rail.json b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/controller_rail.json new file mode 100644 index 000000000..0e88c3224 --- /dev/null +++ b/src/generated/resources/data/create/advancements/recipes/create.base/crafting/kinetics/controller_rail.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "create:crafting/kinetics/controller_rail" + ] + }, + "criteria": { + "has_item": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "item": "minecraft:powered_rail" + } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "create:crafting/kinetics/controller_rail" + } + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/crafting/kinetics/chute.json b/src/generated/resources/data/create/recipes/crafting/kinetics/chute.json index 9b272de35..e8bddbe4b 100644 --- a/src/generated/resources/data/create/recipes/crafting/kinetics/chute.json +++ b/src/generated/resources/data/create/recipes/crafting/kinetics/chute.json @@ -13,6 +13,7 @@ } }, "result": { - "item": "create:chute" + "item": "create:chute", + "count": 4 } } \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/crafting/kinetics/controller_rail.json b/src/generated/resources/data/create/recipes/crafting/kinetics/controller_rail.json new file mode 100644 index 000000000..fadc95421 --- /dev/null +++ b/src/generated/resources/data/create/recipes/crafting/kinetics/controller_rail.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "A A", + "ASA", + "AEA" + ], + "key": { + "A": { + "tag": "forge:ingots/gold" + }, + "E": { + "item": "create:electron_tube" + }, + "S": { + "tag": "forge:rods/wooden" + } + }, + "result": { + "item": "create:controller_rail", + "count": 6 + } +} \ No newline at end of file diff --git a/src/generated/resources/data/create/recipes/crushing/diamond_ore.json b/src/generated/resources/data/create/recipes/crushing/diamond_ore.json new file mode 100644 index 000000000..f16220528 --- /dev/null +++ b/src/generated/resources/data/create/recipes/crushing/diamond_ore.json @@ -0,0 +1,23 @@ +{ + "type": "create:crushing", + "ingredients": [ + { + "item": "minecraft:diamond_ore" + } + ], + "results": [ + { + "item": "minecraft:diamond", + "count": 2 + }, + { + "item": "minecraft:diamond", + "chance": 0.25 + }, + { + "item": "minecraft:cobblestone", + "chance": 0.125 + } + ], + "processingTime": 500 +} \ 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 a4ba851a1..39f44f9c8 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -1,10 +1,29 @@ package com.simibubi.create; +import static com.simibubi.create.AllMovementBehaviours.addMovementBehaviour; +import static com.simibubi.create.AllTags.tagBlockAndItem; +import static com.simibubi.create.content.AllSections.SCHEMATICS; +import static com.simibubi.create.foundation.data.BlockStateGen.axisBlock; +import static com.simibubi.create.foundation.data.BlockStateGen.oxidizedBlockstate; +import static com.simibubi.create.foundation.data.CreateRegistrate.connectedTextures; +import static com.simibubi.create.foundation.data.ModelGen.customItemModel; +import static com.simibubi.create.foundation.data.ModelGen.oxidizedItemModel; + import com.simibubi.create.AllTags.AllBlockTags; import com.simibubi.create.AllTags.AllItemTags; import com.simibubi.create.content.AllSections; import com.simibubi.create.content.contraptions.base.CasingBlock; -import com.simibubi.create.content.contraptions.components.actors.*; +import com.simibubi.create.content.contraptions.components.actors.DrillBlock; +import com.simibubi.create.content.contraptions.components.actors.DrillMovementBehaviour; +import com.simibubi.create.content.contraptions.components.actors.HarvesterBlock; +import com.simibubi.create.content.contraptions.components.actors.HarvesterMovementBehaviour; +import com.simibubi.create.content.contraptions.components.actors.PloughBlock; +import com.simibubi.create.content.contraptions.components.actors.PloughMovementBehaviour; +import com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceBlock; +import com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceMovement; +import com.simibubi.create.content.contraptions.components.actors.SawMovementBehaviour; +import com.simibubi.create.content.contraptions.components.actors.SeatBlock; +import com.simibubi.create.content.contraptions.components.actors.SeatMovementBehaviour; import com.simibubi.create.content.contraptions.components.clock.CuckooClockBlock; import com.simibubi.create.content.contraptions.components.crafter.CrafterCTBehaviour; import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterBlock; @@ -27,7 +46,11 @@ import com.simibubi.create.content.contraptions.components.motor.CreativeMotorGe import com.simibubi.create.content.contraptions.components.press.MechanicalPressBlock; import com.simibubi.create.content.contraptions.components.saw.SawBlock; import com.simibubi.create.content.contraptions.components.saw.SawGenerator; -import com.simibubi.create.content.contraptions.components.structureMovement.bearing.*; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.ClockworkBearingBlock; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.MechanicalBearingBlock; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.SailBlock; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.StabilizedBearingMovementBehaviour; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.WindmillBearingBlock; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.LinearChassisBlock; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.LinearChassisBlock.ChassisCTBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.RadialChassisBlock; @@ -39,6 +62,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pis import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonExtensionPoleBlock; import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyBlock; import com.simibubi.create.content.contraptions.components.tracks.ControllerRailBlock; +import com.simibubi.create.content.contraptions.components.tracks.ControllerRailGenerator; import com.simibubi.create.content.contraptions.components.tracks.ReinforcedRailBlock; import com.simibubi.create.content.contraptions.components.turntable.TurntableBlock; import com.simibubi.create.content.contraptions.components.waterwheel.WaterWheelBlock; @@ -47,7 +71,15 @@ import com.simibubi.create.content.contraptions.fluids.PumpBlock; import com.simibubi.create.content.contraptions.fluids.actors.HosePulleyBlock; import com.simibubi.create.content.contraptions.fluids.actors.ItemDrainBlock; import com.simibubi.create.content.contraptions.fluids.actors.SpoutBlock; -import com.simibubi.create.content.contraptions.fluids.pipes.*; +import com.simibubi.create.content.contraptions.fluids.pipes.BracketBlock; +import com.simibubi.create.content.contraptions.fluids.pipes.BracketBlockItem; +import com.simibubi.create.content.contraptions.fluids.pipes.BracketGenerator; +import com.simibubi.create.content.contraptions.fluids.pipes.EncasedPipeBlock; +import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock; +import com.simibubi.create.content.contraptions.fluids.pipes.FluidValveBlock; +import com.simibubi.create.content.contraptions.fluids.pipes.GlassFluidPipeBlock; +import com.simibubi.create.content.contraptions.fluids.pipes.SmartFluidPipeBlock; +import com.simibubi.create.content.contraptions.fluids.pipes.SmartFluidPipeGenerator; import com.simibubi.create.content.contraptions.fluids.tank.FluidTankBlock; import com.simibubi.create.content.contraptions.fluids.tank.FluidTankGenerator; import com.simibubi.create.content.contraptions.fluids.tank.FluidTankItem; @@ -69,7 +101,12 @@ import com.simibubi.create.content.contraptions.relays.elementary.BracketedKinet import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; import com.simibubi.create.content.contraptions.relays.elementary.CogwheelBlockItem; import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock; -import com.simibubi.create.content.contraptions.relays.encased.*; +import com.simibubi.create.content.contraptions.relays.encased.AdjustablePulleyBlock; +import com.simibubi.create.content.contraptions.relays.encased.ClutchBlock; +import com.simibubi.create.content.contraptions.relays.encased.EncasedBeltBlock; +import com.simibubi.create.content.contraptions.relays.encased.EncasedBeltGenerator; +import com.simibubi.create.content.contraptions.relays.encased.EncasedShaftBlock; +import com.simibubi.create.content.contraptions.relays.encased.GearshiftBlock; import com.simibubi.create.content.contraptions.relays.gauge.GaugeBlock; import com.simibubi.create.content.contraptions.relays.gauge.GaugeGenerator; import com.simibubi.create.content.contraptions.relays.gearbox.GearboxBlock; @@ -80,22 +117,49 @@ import com.simibubi.create.content.logistics.block.chute.ChuteBlock; import com.simibubi.create.content.logistics.block.chute.ChuteGenerator; import com.simibubi.create.content.logistics.block.chute.ChuteItem; import com.simibubi.create.content.logistics.block.depot.DepotBlock; -import com.simibubi.create.content.logistics.block.diodes.*; -import com.simibubi.create.content.logistics.block.funnel.*; +import com.simibubi.create.content.logistics.block.diodes.AbstractDiodeGenerator; +import com.simibubi.create.content.logistics.block.diodes.AdjustableRepeaterBlock; +import com.simibubi.create.content.logistics.block.diodes.AdjustableRepeaterGenerator; +import com.simibubi.create.content.logistics.block.diodes.PoweredLatchBlock; +import com.simibubi.create.content.logistics.block.diodes.PoweredLatchGenerator; +import com.simibubi.create.content.logistics.block.diodes.PulseRepeaterBlock; +import com.simibubi.create.content.logistics.block.diodes.PulseRepeaterGenerator; +import com.simibubi.create.content.logistics.block.diodes.ToggleLatchBlock; +import com.simibubi.create.content.logistics.block.diodes.ToggleLatchGenerator; +import com.simibubi.create.content.logistics.block.funnel.AndesiteBeltFunnelBlock; +import com.simibubi.create.content.logistics.block.funnel.AndesiteFunnelBlock; +import com.simibubi.create.content.logistics.block.funnel.BeltFunnelGenerator; +import com.simibubi.create.content.logistics.block.funnel.BrassBeltFunnelBlock; +import com.simibubi.create.content.logistics.block.funnel.BrassFunnelBlock; +import com.simibubi.create.content.logistics.block.funnel.FunnelMovementBehaviour; import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateBlock; import com.simibubi.create.content.logistics.block.inventories.CreativeCrateBlock; import com.simibubi.create.content.logistics.block.mechanicalArm.ArmBlock; import com.simibubi.create.content.logistics.block.mechanicalArm.ArmItem; -import com.simibubi.create.content.logistics.block.redstone.*; +import com.simibubi.create.content.logistics.block.redstone.AnalogLeverBlock; +import com.simibubi.create.content.logistics.block.redstone.ContactMovementBehaviour; +import com.simibubi.create.content.logistics.block.redstone.ContentObserverBlock; +import com.simibubi.create.content.logistics.block.redstone.NixieTubeBlock; +import com.simibubi.create.content.logistics.block.redstone.NixieTubeGenerator; +import com.simibubi.create.content.logistics.block.redstone.RedstoneContactBlock; +import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkBlock; +import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkGenerator; +import com.simibubi.create.content.logistics.block.redstone.StockpileSwitchBlock; import com.simibubi.create.content.palettes.MetalBlock; import com.simibubi.create.content.schematics.block.SchematicTableBlock; import com.simibubi.create.content.schematics.block.SchematicannonBlock; import com.simibubi.create.foundation.config.StressConfigDefaults; -import com.simibubi.create.foundation.data.*; +import com.simibubi.create.foundation.data.AssetLookup; +import com.simibubi.create.foundation.data.BlockStateGen; +import com.simibubi.create.foundation.data.BuilderTransformers; +import com.simibubi.create.foundation.data.CreateRegistrate; +import com.simibubi.create.foundation.data.ModelGen; +import com.simibubi.create.foundation.data.SharedProperties; import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.utility.DyeHelper; import com.simibubi.create.foundation.worldgen.OxidizingBlock; import com.tterrag.registrate.util.entry.BlockEntry; + import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.SoundType; @@ -112,15 +176,6 @@ import net.minecraftforge.client.model.generators.ConfiguredModel; import net.minecraftforge.common.Tags; import net.minecraftforge.common.ToolType; -import static com.simibubi.create.AllMovementBehaviours.addMovementBehaviour; -import static com.simibubi.create.AllTags.tagBlockAndItem; -import static com.simibubi.create.content.AllSections.SCHEMATICS; -import static com.simibubi.create.foundation.data.BlockStateGen.axisBlock; -import static com.simibubi.create.foundation.data.BlockStateGen.oxidizedBlockstate; -import static com.simibubi.create.foundation.data.CreateRegistrate.connectedTextures; -import static com.simibubi.create.foundation.data.ModelGen.customItemModel; -import static com.simibubi.create.foundation.data.ModelGen.oxidizedItemModel; - public class AllBlocks { private static final CreateRegistrate REGISTRATE = Create.registrate() @@ -685,14 +740,13 @@ public class AllBlocks { public static final BlockEntry CONTROLLER_RAIL = REGISTRATE.block("controller_rail", ControllerRailBlock::new) .initialProperties(() -> Blocks.POWERED_RAIL) - .blockstate(BlockStateGen.controllerRail()) + .blockstate(new ControllerRailGenerator()::generate) .addLayer(() -> RenderType::getCutoutMipped) .onRegister(CreateRegistrate.blockColors(() -> AllColorHandlers::getRedstonePower)) - //.onRegister(CreateRegistrate.blockColorProperty(ControllerRailBlock.POWER)) .tag(BlockTags.RAILS) .item() - .model((c, p) -> p.generated(c, Create.asResource("block/controller_rail_analog"))) - .build() + .model((c, p) -> p.generated(c, Create.asResource("block/" + c.getName() + "_item"))) + .build() .register(); public static final BlockEntry MINECART_ANCHOR = diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java index 7851bf415..f9a4ce521 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailBlock.java @@ -1,19 +1,35 @@ package com.simibubi.create.content.contraptions.components.tracks; +import static net.minecraft.state.properties.RailShape.NORTH_SOUTH; + +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + +import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.wrench.IWrenchable; +import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.VecHelper; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.entity.item.minecart.AbstractMinecartEntity; +import net.minecraft.entity.item.minecart.FurnaceMinecartEntity; import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemUseContext; -import net.minecraft.state.*; +import net.minecraft.state.BooleanProperty; +import net.minecraft.state.EnumProperty; +import net.minecraft.state.IProperty; +import net.minecraft.state.IntegerProperty; +import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.RailShape; 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.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; @@ -23,67 +39,94 @@ import net.minecraft.util.math.Vec3i; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - -import static net.minecraft.state.properties.RailShape.*; - - @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -@SuppressWarnings("deprecation") public class ControllerRailBlock extends AbstractRailBlock implements IWrenchable { + public static final EnumProperty SHAPE = BlockStateProperties.RAIL_SHAPE_STRAIGHT; public static final BooleanProperty BACKWARDS = BooleanProperty.create("backwards"); - /* - * SHAPE | BACKWARDS | FACING - * N/S FALSE North - * N/S TRUE South - * E/W FALSE West - * E/W TRUE East - * ASC_X FALSE X - * ASC_X TRUE X.opposite() - * */ public static final IntegerProperty POWER = BlockStateProperties.POWER_0_15; public ControllerRailBlock(Properties properties) { super(true, properties); - this.setDefaultState(this.stateContainer.getBaseState().with(POWER, 0).with(BACKWARDS, false).with(SHAPE, NORTH_SOUTH)); + this.setDefaultState(this.stateContainer.getBaseState() + .with(POWER, 0) + .with(BACKWARDS, false) + .with(SHAPE, NORTH_SOUTH)); } private static Vec3i getAccelerationVector(BlockState state) { Direction pointingTo = getPointingTowards(state); - return (state.get(BACKWARDS) ? pointingTo.getOpposite() : pointingTo).getDirectionVec(); + return (isStateBackwards(state) ? pointingTo.getOpposite() : pointingTo).getDirectionVec(); } private static Direction getPointingTowards(BlockState state) { switch (state.get(SHAPE)) { - case ASCENDING_WEST: - case EAST_WEST: - return Direction.WEST; - case ASCENDING_EAST: - return Direction.EAST; - case ASCENDING_SOUTH: - return Direction.SOUTH; - default: - return Direction.NORTH; + case ASCENDING_WEST: + case EAST_WEST: + return Direction.WEST; + case ASCENDING_EAST: + return Direction.EAST; + case ASCENDING_SOUTH: + return Direction.SOUTH; + default: + return Direction.NORTH; } } + @Override + protected BlockState getUpdatedState(World world, BlockPos pos, BlockState state, boolean p_208489_4_) { + BlockState updatedState = super.getUpdatedState(world, pos, state, p_208489_4_); + if (updatedState.get(SHAPE) == state.get(SHAPE)) + return updatedState; + BlockState reversedUpdatedState = updatedState; + + // Rails snapping to others at 90 degrees should follow their direction + if (getPointingTowards(state).getAxis() != getPointingTowards(updatedState).getAxis()) { + for (boolean opposite : Iterate.trueAndFalse) { + Direction offset = getPointingTowards(updatedState); + if (opposite) + offset = offset.getOpposite(); + for (BlockPos adjPos : Iterate.hereBelowAndAbove(pos.offset(offset))) { + BlockState adjState = world.getBlockState(adjPos); + if (!AllBlocks.CONTROLLER_RAIL.has(adjState)) + continue; + if (getPointingTowards(adjState).getAxis() != offset.getAxis()) + continue; + if (adjState.get(BACKWARDS) != reversedUpdatedState.get(BACKWARDS)) + reversedUpdatedState = reversedUpdatedState.cycle(BACKWARDS); + } + } + } + + // Replace if changed + if (reversedUpdatedState != updatedState) + world.setBlockState(pos, reversedUpdatedState); + return reversedUpdatedState; + } + private static void decelerateCart(BlockPos pos, AbstractMinecartEntity cart) { - Vec3d diff = VecHelper.getCenterOf(pos).subtract(cart.getPositionVec()); + Vec3d diff = VecHelper.getCenterOf(pos) + .subtract(cart.getPositionVec()); cart.setMotion(diff.x / 16f, 0, diff.z / 16f); + + if (cart instanceof FurnaceMinecartEntity) { + FurnaceMinecartEntity fme = (FurnaceMinecartEntity) cart; + fme.pushX = fme.pushZ = 0; + } } private static boolean isStableWith(BlockState testState, IBlockReader world, BlockPos pos) { - return hasSolidSideOnTop(world, pos.down()) && (!testState.get(SHAPE).isAscending() || hasSolidSideOnTop(world, pos.offset(getPointingTowards(testState)))); + return hasSolidSideOnTop(world, pos.down()) && (!testState.get(SHAPE) + .isAscending() || hasSolidSideOnTop(world, pos.offset(getPointingTowards(testState)))); } @Override public BlockState getStateForPlacement(BlockItemUseContext p_196258_1_) { Direction direction = p_196258_1_.getPlacementHorizontalFacing(); BlockState base = super.getStateForPlacement(p_196258_1_); - return (base == null ? getDefaultState() : base).with(BACKWARDS, direction == Direction.SOUTH || direction == Direction.EAST); + return (base == null ? getDefaultState() : base).with(BACKWARDS, + direction.getAxisDirection() == AxisDirection.POSITIVE); } @Override @@ -101,8 +144,16 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl if (world.isRemote) return; Vec3d accelerationVec = new Vec3d(getAccelerationVector(state)); - double targetSpeed = cart.getMaxSpeedWithRail() * state.get(POWER) / 15.; - if ((cart.getMotion().dotProduct(accelerationVec) >= 0 || cart.getMotion().lengthSquared() < 0.0001) && targetSpeed > 0) + double targetSpeed = cart.getMaxSpeedWithRail() * state.get(POWER) / 15f; + + if (cart instanceof FurnaceMinecartEntity) { + FurnaceMinecartEntity fme = (FurnaceMinecartEntity) cart; + fme.pushX = accelerationVec.x; + fme.pushZ = accelerationVec.z; + } + + Vec3d motion = cart.getMotion(); + if ((motion.dotProduct(accelerationVec) >= 0 || motion.lengthSquared() < 0.0001) && targetSpeed > 0) cart.setMotion(accelerationVec.scale(targetSpeed)); else decelerateCart(pos, cart); @@ -147,105 +198,27 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl if (backwardsPower != 0) break; } + if (forwardDistance > 8 && backwardsDistance > 8) return 0; - else if (backwardsPower == 0 && forwardDistance <= 8) + if (backwardsPower == 0 && forwardDistance <= 8) return forwardPower; - else if (forwardPower == 0 && backwardsDistance <= 8) + if (forwardPower == 0 && backwardsDistance <= 8) return backwardsPower; - else if (backwardsPower != 0 && forwardPower != 0) - return MathHelper.ceil((backwardsPower * forwardDistance + forwardPower * backwardsDistance) / (double) (forwardDistance + backwardsDistance)); + if (backwardsPower != 0 && forwardPower != 0) + return MathHelper.ceil((backwardsPower * forwardDistance + forwardPower * backwardsDistance) + / (double) (forwardDistance + backwardsDistance)); return 0; } - @Override - public BlockState rotate(BlockState p_185499_1_, Rotation p_185499_2_) { - switch (p_185499_2_) { - case CLOCKWISE_180: - switch (p_185499_1_.get(SHAPE)) { - case ASCENDING_EAST: - return p_185499_1_.with(SHAPE, ASCENDING_WEST); - case ASCENDING_WEST: - return p_185499_1_.with(SHAPE, ASCENDING_EAST); - case ASCENDING_NORTH: - return p_185499_1_.with(SHAPE, ASCENDING_SOUTH); - case ASCENDING_SOUTH: - return p_185499_1_.with(SHAPE, ASCENDING_NORTH); - default: - return p_185499_1_.with(BACKWARDS, !p_185499_1_.get(BACKWARDS)); - } - case COUNTERCLOCKWISE_90: - switch (p_185499_1_.get(SHAPE)) { - case ASCENDING_EAST: - return p_185499_1_.with(SHAPE, ASCENDING_NORTH); - case ASCENDING_WEST: - return p_185499_1_.with(SHAPE, ASCENDING_SOUTH); - case ASCENDING_NORTH: - return p_185499_1_.with(SHAPE, ASCENDING_WEST); - case ASCENDING_SOUTH: - return p_185499_1_.with(SHAPE, ASCENDING_EAST); - case NORTH_SOUTH: - return p_185499_1_.with(SHAPE, EAST_WEST); - case EAST_WEST: - return p_185499_1_.with(SHAPE, NORTH_SOUTH).with(BACKWARDS, !p_185499_1_.get(BACKWARDS)); - } - case CLOCKWISE_90: - switch (p_185499_1_.get(SHAPE)) { - case ASCENDING_EAST: - return p_185499_1_.with(SHAPE, ASCENDING_SOUTH); - case ASCENDING_WEST: - return p_185499_1_.with(SHAPE, ASCENDING_NORTH); - case ASCENDING_NORTH: - return p_185499_1_.with(SHAPE, ASCENDING_EAST); - case ASCENDING_SOUTH: - return p_185499_1_.with(SHAPE, ASCENDING_WEST); - case NORTH_SOUTH: - return p_185499_1_.with(SHAPE, EAST_WEST).with(BACKWARDS, !p_185499_1_.get(BACKWARDS)); - case EAST_WEST: - return p_185499_1_.with(SHAPE, NORTH_SOUTH); - } - default: - return p_185499_1_; - } - } - - @Override - public BlockState mirror(BlockState p_185471_1_, Mirror p_185471_2_) { - RailShape railshape = p_185471_1_.get(SHAPE); - switch (p_185471_2_) { - case LEFT_RIGHT: - switch (railshape) { - case ASCENDING_NORTH: - return p_185471_1_.with(SHAPE, RailShape.ASCENDING_SOUTH); - case ASCENDING_SOUTH: - return p_185471_1_.with(SHAPE, RailShape.ASCENDING_NORTH); - case NORTH_SOUTH: - return p_185471_1_.with(BACKWARDS, !p_185471_1_.get(BACKWARDS)); - default: - return super.mirror(p_185471_1_, p_185471_2_); - } - case FRONT_BACK: - switch (railshape) { - case ASCENDING_EAST: - return p_185471_1_.with(SHAPE, RailShape.ASCENDING_WEST); - case ASCENDING_WEST: - return p_185471_1_.with(SHAPE, RailShape.ASCENDING_EAST); - case EAST_WEST: - return p_185471_1_.with(BACKWARDS, !p_185471_1_.get(BACKWARDS)); - default: - break; - } - } - return super.mirror(p_185471_1_, p_185471_2_); - } - @Override public ActionResultType onWrenched(BlockState state, ItemUseContext context) { World world = context.getWorld(); if (world.isRemote) return ActionResultType.SUCCESS; BlockPos pos = context.getPos(); - for (Rotation testRotation : new Rotation[]{Rotation.CLOCKWISE_90, Rotation.CLOCKWISE_180, Rotation.COUNTERCLOCKWISE_90}) { + for (Rotation testRotation : new Rotation[] { Rotation.CLOCKWISE_90, Rotation.CLOCKWISE_180, + Rotation.COUNTERCLOCKWISE_90 }) { BlockState testState = rotate(state, testRotation); if (isStableWith(testState, world, pos)) { placeAndNotify(testState, pos, world); @@ -268,7 +241,8 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl private void placeAndNotify(BlockState state, BlockPos pos, World world) { world.setBlockState(pos, state, 3); world.notifyNeighborsOfStateChange(pos.down(), this); - if (state.get(SHAPE).isAscending()) + if (state.get(SHAPE) + .isAscending()) world.notifyNeighborsOfStateChange(pos.up(), this); } @@ -279,11 +253,13 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl return null; Vec3i accelerationVec = getAccelerationVector(current); BlockPos baseTestPos = reversed ? from.subtract(accelerationVec) : from.add(accelerationVec); - for (BlockPos testPos : new BlockPos[]{baseTestPos, baseTestPos.down(), baseTestPos.up()}) { - if (testPos.getY() > from.getY() && !current.get(SHAPE).isAscending()) + for (BlockPos testPos : Iterate.hereBelowAndAbove(baseTestPos)) { + if (testPos.getY() > from.getY() && !current.get(SHAPE) + .isAscending()) continue; BlockState testState = world.getBlockState(testPos); - if (testState.getBlock() instanceof ControllerRailBlock && getAccelerationVector(testState).equals(accelerationVec)) + if (testState.getBlock() instanceof ControllerRailBlock + && getAccelerationVector(testState).equals(accelerationVec)) return testPos; } return null; @@ -298,4 +274,47 @@ public class ControllerRailBlock extends AbstractRailBlock implements IWrenchabl public int getComparatorInputOverride(BlockState state, World world, BlockPos pos) { return state.get(POWER); } + + @Override + public BlockState rotate(BlockState state, Rotation rotation) { + if (rotation == Rotation.NONE) + return state; + + RailShape railshape = Blocks.POWERED_RAIL.getDefaultState() + .with(SHAPE, state.get(SHAPE)) + .rotate(rotation) + .get(SHAPE); + state = state.with(SHAPE, railshape); + + if (rotation == Rotation.CLOCKWISE_180 + || (getPointingTowards(state).getAxis() == Axis.Z) == (rotation == Rotation.COUNTERCLOCKWISE_90)) + return state.cycle(BACKWARDS); + + return state; + } + + @Override + public BlockState mirror(BlockState state, Mirror mirror) { + if (mirror == Mirror.NONE) + return state; + + RailShape railshape = Blocks.POWERED_RAIL.getDefaultState() + .with(SHAPE, state.get(SHAPE)) + .mirror(mirror) + .get(SHAPE); + state = state.with(SHAPE, railshape); + + if ((getPointingTowards(state).getAxis() == Axis.Z) == (mirror == Mirror.LEFT_RIGHT)) + return state.cycle(BACKWARDS); + + return state; + } + + public static boolean isStateBackwards(BlockState state) { + return state.get(BACKWARDS) ^ isReversedSlope(state); + } + + public static boolean isReversedSlope(BlockState state) { + return state.get(SHAPE) == RailShape.ASCENDING_SOUTH || state.get(SHAPE) == RailShape.ASCENDING_EAST; + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailGenerator.java b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailGenerator.java new file mode 100644 index 000000000..fd696ed47 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/tracks/ControllerRailGenerator.java @@ -0,0 +1,55 @@ +package com.simibubi.create.content.contraptions.components.tracks; + +import com.simibubi.create.foundation.data.AssetLookup; +import com.simibubi.create.foundation.data.SpecialBlockStateGen; +import com.tterrag.registrate.providers.DataGenContext; +import com.tterrag.registrate.providers.RegistrateBlockstateProvider; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.state.IProperty; +import net.minecraft.state.properties.RailShape; +import net.minecraftforge.client.model.generators.ModelFile; + +public class ControllerRailGenerator extends SpecialBlockStateGen { + + @Override + protected IProperty[] getIgnoredProperties() { + return new IProperty[] { ControllerRailBlock.POWER }; + } + + @Override + protected int getXRotation(BlockState state) { + return 0; + } + + @Override + protected int getYRotation(BlockState state) { + RailShape shape = state.get(ControllerRailBlock.SHAPE); + boolean backwards = ControllerRailBlock.isStateBackwards(state); + int rotation = backwards ? 180 : 0; + + switch (shape) { + case EAST_WEST: + case ASCENDING_WEST: + return rotation + 270; + case ASCENDING_EAST: + return rotation + 90; + case ASCENDING_SOUTH: + return rotation + 180; + default: + return rotation; + } + } + + @Override + public ModelFile getModel(DataGenContext ctx, RegistrateBlockstateProvider prov, + BlockState state) { + RailShape shape = state.get(ControllerRailBlock.SHAPE); + boolean backwards = ControllerRailBlock.isStateBackwards(state); + + String model = shape.isAscending() ? backwards ? "ascending_south" : "ascending_north" : "north_south"; + return AssetLookup.partialBaseModel(ctx, prov, model); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java index cdb2a16e3..047d9b454 100644 --- a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java @@ -1,6 +1,16 @@ package com.simibubi.create.foundation.data; +import java.util.HashMap; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; +import java.util.function.BiFunction; +import java.util.function.Function; + +import org.apache.commons.lang3.tuple.Pair; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock; @@ -8,7 +18,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.cha import com.simibubi.create.content.contraptions.components.structureMovement.chassis.RadialChassisBlock; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssembleRailType; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock; -import com.simibubi.create.content.contraptions.components.tracks.ControllerRailBlock; import com.simibubi.create.content.contraptions.components.tracks.ReinforcedRailBlock; import com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock; @@ -21,6 +30,7 @@ import com.tterrag.registrate.providers.DataGenContext; import com.tterrag.registrate.providers.RegistrateBlockstateProvider; import com.tterrag.registrate.util.nullness.NonNullBiConsumer; import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.state.BooleanProperty; @@ -33,11 +43,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.generators.ConfiguredModel; import net.minecraftforge.client.model.generators.ModelFile; import net.minecraftforge.client.model.generators.MultiPartBlockStateBuilder; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.*; -import java.util.function.BiFunction; -import java.util.function.Function; public class BlockStateGen { @@ -428,47 +433,4 @@ public class BlockStateGen { .condition(propertyMap.get(Pointing.DOWN.getCombinedDirection(positiveAxis)), down) .end(); } - - public static NonNullBiConsumer, RegistrateBlockstateProvider> controllerRail() { - return (c, p) -> p.getVariantBuilder(c.get()) - .forAllStatesExcept(state -> { - //int power = state.get(ControllerRailBlock.POWER); - boolean backwards = state.get(ControllerRailBlock.BACKWARDS); - //String powerStr = power == 0 ? "off" : (power == 15 ? "on" : "analog"); - RailShape shape = state.get(ControllerRailBlock.SHAPE); - String shapeName = shape.isAscending() ? RailShape.ASCENDING_NORTH.getName() : RailShape.NORTH_SOUTH.getName(); - int rotation = 0; - - switch (shape) { - case EAST_WEST: - rotation += 270; - shapeName = RailShape.NORTH_SOUTH.getName(); - break; - case ASCENDING_EAST: - rotation += 90; - break; - case ASCENDING_SOUTH: - rotation += 180; - break; - case ASCENDING_WEST: - rotation += 270; - break; - default: - break; - } - - if (backwards) { - rotation += 180; - shapeName = shape.isAscending() ? RailShape.ASCENDING_SOUTH.getName() : RailShape.NORTH_SOUTH.getName(); - } - - - return ConfiguredModel.builder() - .modelFile(p.models() - .getExistingFile(p.modLoc( - "block/" + c.getName() + "/block_" + shapeName))) - .rotationY(rotation % 360) - .build(); - }, ControllerRailBlock.POWER); - } } diff --git a/src/main/java/com/simibubi/create/foundation/data/SpecialBlockStateGen.java b/src/main/java/com/simibubi/create/foundation/data/SpecialBlockStateGen.java index bc4ee17e2..ad994851e 100644 --- a/src/main/java/com/simibubi/create/foundation/data/SpecialBlockStateGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/SpecialBlockStateGen.java @@ -5,21 +5,26 @@ import com.tterrag.registrate.providers.RegistrateBlockstateProvider; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.state.IProperty; import net.minecraft.util.Direction; import net.minecraftforge.client.model.generators.ConfiguredModel; import net.minecraftforge.client.model.generators.ModelFile; public abstract class SpecialBlockStateGen { + protected IProperty[] getIgnoredProperties() { + return new IProperty[0]; + } + public final void generate(DataGenContext ctx, RegistrateBlockstateProvider prov) { prov.getVariantBuilder(ctx.getEntry()) - .forAllStates(state -> { + .forAllStatesExcept(state -> { return ConfiguredModel.builder() .modelFile(getModel(ctx, prov, state)) .rotationX((getXRotation(state) + 360) % 360) .rotationY((getYRotation(state) + 360) % 360) .build(); - }); + }, getIgnoredProperties()); } protected int horizontalAngle(Direction direction) { diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/CrushingRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/CrushingRecipeGen.java index b5e74e900..2b1e91a29 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/CrushingRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/CrushingRecipeGen.java @@ -75,6 +75,11 @@ public class CrushingRecipeGen extends ProcessingRecipeGen { .output(Items.EMERALD, 2) .output(.25f, Items.EMERALD, 1) .output(.125f, Blocks.COBBLESTONE)), + + DIAMOND_ORE = create(() -> Blocks.DIAMOND_ORE, b -> b.duration(500) + .output(Items.DIAMOND, 2) + .output(.25f, Items.DIAMOND, 1) + .output(.125f, Blocks.COBBLESTONE)), NETHER_WART_NO_QUARK = create("nether_wart_block_no_quark", b -> b.duration(150) .require(Blocks.NETHER_WART_BLOCK) diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java index 15a02e6fa..1265126f4 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java @@ -329,6 +329,15 @@ public class StandardRecipeGen extends CreateRecipeProvider { .patternLine("CRC") .patternLine("L L")), + CONTROLLER_RAIL = create(AllBlocks.CONTROLLER_RAIL).returns(6) + .unlockedBy(() -> Items.POWERED_RAIL) + .viaShaped(b -> b.key('A', I.gold()) + .key('E', I.electronTube()) + .key('S', Tags.Items.RODS_WOODEN) + .patternLine("A A") + .patternLine("ASA") + .patternLine("AEA")), + HAND_CRANK = create(AllBlocks.HAND_CRANK).unlockedBy(I::andesite) .viaShaped(b -> b.key('A', I.andesite()) .key('C', ItemTags.PLANKS) @@ -536,6 +545,7 @@ public class StandardRecipeGen extends CreateRecipeProvider { .patternLine("AA")), CHUTE = create(AllBlocks.CHUTE).unlockedBy(I::andesite) + .returns(4) .viaShaped(b -> b.key('A', I.ironSheet()) .key('I', I.andesite()) .patternLine("II") diff --git a/src/main/java/com/simibubi/create/foundation/utility/Iterate.java b/src/main/java/com/simibubi/create/foundation/utility/Iterate.java index 84e7cccd1..70206344d 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/Iterate.java +++ b/src/main/java/com/simibubi/create/foundation/utility/Iterate.java @@ -38,4 +38,8 @@ public class Iterate { public static List hereAndBelow(BlockPos pos) { return Arrays.asList(pos, pos.down()); } + + public static List hereBelowAndAbove(BlockPos pos) { + return Arrays.asList(pos, pos.down(), pos.up()); + } } diff --git a/src/main/resources/assets/create/textures/block/controller_rail_analog.png b/src/main/resources/assets/create/textures/block/controller_rail_analog.png deleted file mode 100644 index f114dde12136d880f9dc1bd4c2d6466442604984..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 336 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}B0G|+7AU$W!oQ#Z&lO3|{xvqECX(ll-ZJiLgq`|AGGB3zkWA&QVpATvo zGBCvW8mwk!OlM*QYFVM5lL4fJN`m}?|DywjNBj2+0cAN0JR*x382Ao@Fyrz36)8Z$ zR!RX#E}C{TWlm19cg2?4LD>C6{?UEg;tGST`%pL2LF!#zH0>qV*7 zOmAdQ9dEoYsBWxy*Ls~v)_K0kK}FMA(%V1%O||}azx+SrHVdv3RvrAIKnF2+y85}S Ib4q9e0O3-7H~;_u diff --git a/src/main/resources/assets/create/textures/block/controller_rail_base.png b/src/main/resources/assets/create/textures/block/controller_rail_base.png index 21f528338699b789b60ad6a9e86f20d298ef8513..c8f72e61c20f8ce08f0a6df27ece26107bcb585a 100644 GIT binary patch delta 657 zcmV;C0&e~45~u}`BYy#dX+uL$Nkc;*P;zf(X>4Tx04UFukxM8wW?=oX`_)&>VI|9%}m5b% zrdwt4zfqr9bWJGJgon(GlNDYN9$3p}6z>WL%_Th{d@9`K$OVP(m2TwuMRCgKfXWOy z@#wH{P*_V9u~Ee4l4A+?3x^VxE%|}zJSP;dE4I?B=FdIV3+oo`shHAbwi02C2`14n zSY??sS-NGlMSpRL%6_&++Cg`x7v^WNH_ zY8$?`Jn!?+^S+Lt{1Gnff`26kgYTkm6|~R+G;F}xWkEA`;CvIBA2Pb5`%<~gKr#uh zC-O}*&~yzobNSwW_Bpyu_uXoL2O_fq|kxP`9hMwKWX171aYM&_DTs(?2*Ra6dd`aJN8OX rtV``#c-*ut>0E3T9ZUNEec%V5CaB^>EX>4U6ba`-PAZ2)IW&i+q+O1bvk}D|; z{O1&N1SA&0aabeX4d(chY~`}s?(P>cU2PXoln}~P3aj?-pRWGFA6sLUbrO8^UgOV3 z8#$p7^!khQo3x$ZyQ5FzXsYmj`Bj z5=IE$Y$E27322XC-dfZY4w z&k)}hHkU{I{C~ja3*j$8?!AWI+uB{S9uf7MQCgkojCU|G!<3n?d0c{zLtEw*aRr@p z0pwK|opBY4#6YDhvQ#Nir#A0}3S6|@Sa4@9Z01-n!jX#^IN5PgXED)KpvIessZ20Nc;(}zzI*sLm+HNY5Rnd7tbgDa59Y#+f!z4UEC51%v%x%v`${2FQnvww2x~hygA}l&JsC%yv@i=1 z;uru>g6C{3XCOe%afOpmBjZ^K2OewV9icgw9eW%L15J@#~=wo(0Z{RL{YQR9i!n13f1Y8X`_#{>;IaRW0T#+HD%3Gs*787ZV5TD@DICK|H?UEa24bV2G-B83!tR0GuW(Z?{0cYz2{|>O`#+FVfbJ`9 zZ&0hF&XtMS%EA#-ZIFF<-a=9w(kNA9Qg z{Cv*~7AEWPj~XL&Hj6H4&4z|s1X<0w&5htffcGZIj(t$tdvMqTLbbY8=fS9lqaC~F zpwO)j9JzL5?V1#9gSIdCQ)?!MZXUaFdw>V4NQWT3(eBj)Ogb0Kr<%77@=}s)Uee25vI^V0qguqp`9M;_*`t)TK#Wkzz8(}E z0V*_hb*qm}Vi{~#n2Ckp%j+U;6VsVeP0pv&bf|rE&zJ5(@w2CLs}^Z%^6F>HIHPW` zIDjnWC(S-^-;DPORu8x1sLU3#Knek?V9)HIZa3OHEr z)sl&Pj(Zf>nb$NplAO$7e+$dD!dwc4Wzaej41b@D~+01qg zC;y&WbSvaw0xB+VjC>fd{W67BLn%D4g9D$mte%{l+{(+y($=Lr>Rm3Eow1{e@lf`g zu)i*G@>$JPMgS&#g^H;~plD947 zHGT-#cgd_~HpjytKO7MJ7=M`5wxGymnpY##D=V<$1ySfBDpTcDbpW^y-SJR)JvmuTgse0#PiPWH*@+4`u zoP82|^@G}*>ot>0004nX+uL$Nkc;*aB^>EX>4Tx0C=2zkv&MmKpe$iQ>CIUB6bi_$WV2$AS&W0 zRV;#q(pG5I!Q|2}Xws0RxHt-~1qVMCs}3&Cx;nTDg5U>;lYgU=qKlOHzogJ2)`R1I zyu0_fdj|-$5>w5N2|(2>BN2^=>CCF=dqoe1(T6bvBxdTdv0B!&2#c-){15 z=37{9VOB6y;(ux4kfLgoFQi>oIB#)QOBL3*Cx4+otF0utPICxREFp$CM98S1h!QM> zY1K$Ek)ZuZ8~>o=kCRI#R}qXH3n)W{D8tdIs$sPfs5;=Chq~4JAc5ylP(#OBY9~Gxg79*M&FbH z`fq{mHMh6MK29Hi6m_+H0~{Ozqj}0+Z}aZ1*53X-)9CL9n*nmS1qqP*0000yP)t-s ziU0rr005kvoM>oh$%q|?ZAIL!DbxW1wUAk)fJ$NS%G}x0G|+7AU$W!oQ#Z&lO3|{xvqECX)bB-+BzY!s4_3eS!4B@)t?V)#rPT+ zGBEfuGA1!G0oC7ro3;r^36=!;1^-6_4618qCIKZm3p^r=85sBufiR<}hF1enu+h`S zF+?NSw?9(ohyn-e;Z=biJN{>~Z@;1tAA5;^9fw0#WQ#x{D|6ShMW;dhpQg5XE6O+QoB@Tg7V#s?z0k(=dE1h ztL$#~vdi|8?CF5r(`tNfEGyA5)0PeXRbO|6pLHf@$<~Bf@j%Bgc)I$ztaD0e0stA= Bc=-ST literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/create/textures/block/controller_rail_off.png b/src/main/resources/assets/create/textures/block/controller_rail_off.png deleted file mode 100644 index 346d2fb671b9c36bea25f64a61acbd0dd2faa0d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 331 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}x0G|+7AU$W!oQ#Z&lO3|{xvqECX(ll-ZJiLgq`|AGGB3zkWA&QVpATwz zF*C>b8W;jqGcY`0R(}Sh1WSVag8!od2GzAQlYo+(1s;*b3=DjSL74G){)!Z!V2h`V zV~9quZ@(iSiy{XLJIfS7_kaIyxgJgV9l?3^>|?%&n&k>R?EM;awwg^^~ZdM*0g+iv*Xf=v$ASyuUc_E<9oWZZszrm|M&gouRFt)S<`U#1JFGTp00i_>zopr E06IT?F8}}l diff --git a/src/main/resources/assets/create/textures/block/controller_rail_on.png b/src/main/resources/assets/create/textures/block/controller_rail_on.png deleted file mode 100644 index bd61741a5f5dd2f93e73044c3af87ca434030b6d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 342 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}Z0G|+7AU$W!oQ#Z&lO3|{xvqECXN*w4h+0kVLBd$K_WkP`LPr!hSeTi-YE&NnYmW_CbL;0Dt*W-uJO($toD6pNFhmyVsdzTZ z+!2kIpLZ@IpFPafPwHA_l0jpM@ikVCDV{D?s%uX(-Z=Jo&-;Ydw+F=dVz=^DSVz72 zFzs!@hH{N|=KjO}X)(LXWmaB4)~B}g$sOTid{6WLeUd%?|96`G-2`sMZ~yHiflgxZ MboFyt=akR{0OqEF^#A|> diff --git a/src/main/resources/assets/create/textures/block/controller_rail_tint.png b/src/main/resources/assets/create/textures/block/controller_rail_tint.png index b23090504790481f6792ad3721f22c9b3776baf2..ac6002c83a3547ced9344aad2f80f51f9f3ab2c8 100644 GIT binary patch delta 571 zcmV-B0>u5<2gwAG8Gi!+001a04^sdD0fT8nLr_UWLm*IcZ)Rz1WdHyu&y|r&C`3^l z#(xHpN0M1c)LjfVl#nbnWKxu7MtLpVd&dkl_nPh<*;p!DW#O?gSlC#zwXju6d6cXy zt%!|u{m&gWlN#mJ>HPZ6`M%Ei4g_*(({d|%z_PPWG!oXPXMbk3s%L6xqmfSPb<@pE z#75(k93Quosr9B?W%0jJpICHFDAR<8%#4#2UJxEw%Vres3J1+4Jt2H5+~vpxh3}Pa z)X`ud)pp1i!g0002ACwj5~000Se zQchF<|NsC0|Ns90Q%`sj00009a7bBm000ic000ic0Tn1pfB*mhFiAu~R47wp;6MY! z3otT488lDapZv3T?;NJv@B93-he@=l&c4C2KOkBNERs-LQx^h-Wq}o%23%kQF3__?&p$pbHW| za$R=$jdR{%foBGdRAQbuNG#@CSZ-lfFjV4c;*g?hlrN-RRyc2QR!bGuxF>(1KdY@I zxlVHkQ7j>bIDbUQsGx`vEQD#*NHLM1{YV@CpyQ8|OD0zlj2sInLxtq{!T;cQw`Oi? z(oOP5fX)}&{ulv#yFk5a+uz5wT|WW5&%l+|^p|VE>?i5frWQH^dbfd#>!v2}0hc?# zz>_W+k|TL(3b`Ecen#Jv0s3!&?lrf!#y(CTfE0DLe18KR90H?x%3g2t?ylC}{yo#^ z?+2R!a<>iIT08&%00v@9M??Vs0RI60puMM)00009a7bBm000id000id0mpBsWB>pF z2XskIMF->y9TEjQM|>w30005iNklA!TrGX}pgc|~Z4gopPK|xUm zhvINcR)29g1VN{B$mUSDZmC<*!R6czgn*?`Dxzd?5GjWscO-@zBv23}gjyPs zT<&t|<@zok-~Zq5dEXc2VHgIwu5-M*Nm?B5ZldcthG9f&R{$DyHCm9BJf7!?qdkqI zJq>fGMx(Cc`@R6!D6JE}vj$*wPSCar0F-43*MD_+-}<%myW=>>N}kbYpF**~$Ii*( zf&Eq&?RoHe=lePLwr@xm<(r4MrSq@XqxpWTyRZOo_U|m=+4DSM+qMYje+MG6a4Cb( zvk(GBQE(hbH0mk?cNm>ZFsR*x(Wy^amT33-n5M~WHltFhkj-Xk_xe0~kOwPJYb6;J zVt;;rVjezAaCrOT5(aUfVN9n}(d~9ce1CN6r!&|ntut_kH0mmz=ZVQ=LbY1OwrvsT zw35Nqtp&vPw?55g6M$SUM<$b@-Rm!@vsTqXC@)~}B*9?k>9r`0sdZ46rPN*s(^x1j zfUjL-05Bep#fMi9C4kcW@ZHC+#qW2wq(@L?qptGu&6njm2(w@v9PsJKpZOobSiIv> wR`SqGse_spFc`Q)v~6ugFWi^ntsXM?4`4LxxFTG_zW@LL07*qoM6N<$f;wKvM*si-