From 33a08a235ec460c2b55eea08964d18e1b9eeceb4 Mon Sep 17 00:00:00 2001 From: _0Steven <42909981+SuicidalSteve@users.noreply.github.com> Date: Mon, 22 Feb 2021 13:09:50 +0100 Subject: [PATCH 1/2] Turbines- I mean horizontal water wheels - Make water wheels work and be able to be placed horizontally --- src/generated/resources/.cache/cache | 4 +- .../assets/create/blockstates/fluid_pipe.json | 168 +++++++++--------- .../create/blockstates/water_wheel.json | 7 + .../java/com/simibubi/create/AllBlocks.java | 2 +- .../waterwheel/WaterWheelBlock.java | 28 +-- 5 files changed, 112 insertions(+), 97 deletions(-) diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 463f09ef7..be14b563c 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -140,7 +140,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 -48086bf71a824faf14841b698050cc8544b09a9b assets/create/blockstates/fluid_pipe.json +cedc68a9c3ab47a94bd8200889316a708c25950a 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 @@ -379,7 +379,7 @@ a2454400b1cf9889f70aebdc89c52a1be25f543c assets/create/blockstates/tiled_glass_p a8094531617e27a545c4815ab2062bf0ffca3633 assets/create/blockstates/turntable.json 69dfe8afaa8eb6105dae9f76ab8b7847bf90b8c6 assets/create/blockstates/vertical_framed_glass.json c4db76b9d36cfb098df0d158cb6f8b82768ebe14 assets/create/blockstates/vertical_framed_glass_pane.json -d995547bcd71603ba7378d8998098e462030bfd0 assets/create/blockstates/water_wheel.json +d31fce8315c8715521d66b5dcc166c84e949dd1d assets/create/blockstates/water_wheel.json f182669f7547964f9f2ef67916568556870def7b assets/create/blockstates/weathered_limestone.json 27e6740834c0f673acc3531371512daa6dcab025 assets/create/blockstates/weathered_limestone_bricks.json abb74e4f4c2b9851670cb6ad794281b0f7be0f5a assets/create/blockstates/weathered_limestone_bricks_slab.json diff --git a/src/generated/resources/assets/create/blockstates/fluid_pipe.json b/src/generated/resources/assets/create/blockstates/fluid_pipe.json index 80a25280c..d4179b0cb 100644 --- a/src/generated/resources/assets/create/blockstates/fluid_pipe.json +++ b/src/generated/resources/assets/create/blockstates/fluid_pipe.json @@ -60,10 +60,10 @@ }, { "when": { + "north": "true", "down": "false", - "up": "true", "south": "false", - "north": "true" + "up": "true" }, "apply": { "model": "create:block/fluid_pipe/lu_x" @@ -71,10 +71,10 @@ }, { "when": { + "north": "false", "down": "false", - "up": "true", "south": "true", - "north": "false" + "up": "true" }, "apply": { "model": "create:block/fluid_pipe/ru_x" @@ -82,10 +82,10 @@ }, { "when": { + "north": "true", "down": "true", - "up": "false", "south": "false", - "north": "true" + "up": "false" }, "apply": { "model": "create:block/fluid_pipe/ld_x" @@ -93,10 +93,10 @@ }, { "when": { + "north": "false", "down": "true", - "up": "false", "south": "true", - "north": "false" + "up": "false" }, "apply": { "model": "create:block/fluid_pipe/rd_x" @@ -104,10 +104,10 @@ }, { "when": { + "north": "false", "down": "true", - "up": "true", "south": "false", - "north": "false" + "up": "true" }, "apply": { "model": "create:block/fluid_pipe/ud_x" @@ -115,10 +115,10 @@ }, { "when": { + "north": "false", "down": "false", - "up": "true", "south": "false", - "north": "false" + "up": "true" }, "apply": { "model": "create:block/fluid_pipe/ud_x" @@ -126,10 +126,10 @@ }, { "when": { + "north": "false", "down": "true", - "up": "false", "south": "false", - "north": "false" + "up": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_x" @@ -137,10 +137,10 @@ }, { "when": { + "north": "true", "down": "false", - "up": "false", "south": "true", - "north": "true" + "up": "false" }, "apply": { "model": "create:block/fluid_pipe/lr_x" @@ -148,10 +148,10 @@ }, { "when": { + "north": "true", "down": "false", - "up": "false", "south": "false", - "north": "true" + "up": "false" }, "apply": { "model": "create:block/fluid_pipe/lr_x" @@ -159,10 +159,10 @@ }, { "when": { + "north": "false", "down": "false", - "up": "false", "south": "true", - "north": "false" + "up": "false" }, "apply": { "model": "create:block/fluid_pipe/lr_x" @@ -170,10 +170,10 @@ }, { "when": { + "north": "false", "down": "false", - "up": "false", "south": "false", - "north": "false" + "up": "false" }, "apply": { "model": "create:block/fluid_pipe/none_x" @@ -181,10 +181,10 @@ }, { "when": { - "south": "true", - "west": "true", + "east": "false", "north": "false", - "east": "false" + "south": "true", + "west": "true" }, "apply": { "model": "create:block/fluid_pipe/lu_y" @@ -192,10 +192,10 @@ }, { "when": { - "south": "true", - "west": "false", + "east": "true", "north": "false", - "east": "true" + "south": "true", + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/ru_y" @@ -203,10 +203,10 @@ }, { "when": { - "south": "false", - "west": "true", + "east": "false", "north": "true", - "east": "false" + "south": "false", + "west": "true" }, "apply": { "model": "create:block/fluid_pipe/ld_y" @@ -214,10 +214,10 @@ }, { "when": { - "south": "false", - "west": "false", + "east": "true", "north": "true", - "east": "true" + "south": "false", + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/rd_y" @@ -225,21 +225,10 @@ }, { "when": { - "south": "true", - "west": "false", + "east": "false", "north": "true", - "east": "false" - }, - "apply": { - "model": "create:block/fluid_pipe/ud_y" - } - }, - { - "when": { "south": "true", - "west": "false", - "north": "false", - "east": "false" + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_y" @@ -247,10 +236,21 @@ }, { "when": { - "south": "false", - "west": "false", + "east": "false", + "north": "false", + "south": "true", + "west": "false" + }, + "apply": { + "model": "create:block/fluid_pipe/ud_y" + } + }, + { + "when": { + "east": "false", "north": "true", - "east": "false" + "south": "false", + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_y" @@ -258,10 +258,10 @@ }, { "when": { - "south": "false", - "west": "true", + "east": "true", "north": "false", - "east": "true" + "south": "false", + "west": "true" }, "apply": { "model": "create:block/fluid_pipe/lr_y" @@ -269,10 +269,10 @@ }, { "when": { - "south": "false", - "west": "true", + "east": "false", "north": "false", - "east": "false" + "south": "false", + "west": "true" }, "apply": { "model": "create:block/fluid_pipe/lr_y" @@ -280,10 +280,10 @@ }, { "when": { - "south": "false", - "west": "false", + "east": "true", "north": "false", - "east": "true" + "south": "false", + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/lr_y" @@ -291,10 +291,10 @@ }, { "when": { - "south": "false", - "west": "false", + "east": "false", "north": "false", - "east": "false" + "south": "false", + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/none_y" @@ -302,10 +302,10 @@ }, { "when": { + "east": "true", "down": "false", "up": "true", - "west": "false", - "east": "true" + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/lu_z" @@ -313,10 +313,10 @@ }, { "when": { + "east": "false", "down": "false", "up": "true", - "west": "true", - "east": "false" + "west": "true" }, "apply": { "model": "create:block/fluid_pipe/ru_z" @@ -324,10 +324,10 @@ }, { "when": { + "east": "true", "down": "true", "up": "false", - "west": "false", - "east": "true" + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/ld_z" @@ -335,10 +335,10 @@ }, { "when": { + "east": "false", "down": "true", "up": "false", - "west": "true", - "east": "false" + "west": "true" }, "apply": { "model": "create:block/fluid_pipe/rd_z" @@ -346,10 +346,10 @@ }, { "when": { + "east": "false", "down": "true", "up": "true", - "west": "false", - "east": "false" + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_z" @@ -357,10 +357,10 @@ }, { "when": { + "east": "false", "down": "false", "up": "true", - "west": "false", - "east": "false" + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_z" @@ -368,10 +368,10 @@ }, { "when": { + "east": "false", "down": "true", "up": "false", - "west": "false", - "east": "false" + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/ud_z" @@ -379,10 +379,10 @@ }, { "when": { + "east": "true", "down": "false", "up": "false", - "west": "true", - "east": "true" + "west": "true" }, "apply": { "model": "create:block/fluid_pipe/lr_z" @@ -390,10 +390,10 @@ }, { "when": { + "east": "true", "down": "false", "up": "false", - "west": "false", - "east": "true" + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/lr_z" @@ -401,10 +401,10 @@ }, { "when": { + "east": "false", "down": "false", "up": "false", - "west": "true", - "east": "false" + "west": "true" }, "apply": { "model": "create:block/fluid_pipe/lr_z" @@ -412,10 +412,10 @@ }, { "when": { + "east": "false", "down": "false", "up": "false", - "west": "false", - "east": "false" + "west": "false" }, "apply": { "model": "create:block/fluid_pipe/none_z" diff --git a/src/generated/resources/assets/create/blockstates/water_wheel.json b/src/generated/resources/assets/create/blockstates/water_wheel.json index c9b0731b7..fe99163df 100644 --- a/src/generated/resources/assets/create/blockstates/water_wheel.json +++ b/src/generated/resources/assets/create/blockstates/water_wheel.json @@ -1,5 +1,12 @@ { "variants": { + "facing=down": { + "model": "create:block/water_wheel", + "x": 180 + }, + "facing=up": { + "model": "create:block/water_wheel" + }, "facing=north": { "model": "create:block/water_wheel", "x": 90 diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index aea45c42e..5c35fd66c 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -335,7 +335,7 @@ public class AllBlocks { public static final BlockEntry WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new) .initialProperties(SharedProperties::wooden) .properties(Block.Properties::nonOpaque) - .blockstate(BlockStateGen.horizontalWheelProvider(false)) + .blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(false)) .addLayer(() -> RenderType::getCutoutMipped) .transform(StressConfigDefaults.setCapacity(16.0)) .simpleItem() diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlock.java index ce91f8c47..11060e7f9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlock.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.waterwheel; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllFluids; import com.simibubi.create.AllTileEntities; +import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.block.ITE; @@ -28,7 +29,7 @@ import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -public class WaterWheelBlock extends HorizontalKineticBlock implements ITE { +public class WaterWheelBlock extends DirectionalKineticBlock implements ITE { public WaterWheelBlock(Properties properties) { super(properties); @@ -51,10 +52,10 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE 0 ^ !clockwise ? -flow.y * clockwiseMultiplier : -flow.y; } + if (wf.getAxis() == Axis.Y) { + if (side.getAxis() == Axis.Z) + flowStrength = flow.x < 0 ^ !clockwise ? flow.x * clockwiseMultiplier : flow.x; + if (side.getAxis() == Axis.X) + flowStrength = flow.z > 0 ^ !clockwise ? -flow.z * clockwiseMultiplier : -flow.z; + } + if (te.getSpeed() == 0 && flowStrength != 0 && !world.isRemote) { AllTriggers.triggerForNearbyPlayers(AllTriggers.WATER_WHEEL, world, pos, 5); if (FluidHelper.isLava(fluid.getFluid())) @@ -148,23 +156,23 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE Date: Mon, 22 Feb 2021 13:44:09 +0100 Subject: [PATCH 2/2] ...Update imports - Remove a singular now unused import from WaterWheelBlock.java cause I apparently just forgot to do so. --- .../contraptions/components/waterwheel/WaterWheelBlock.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlock.java index 11060e7f9..b36ef1110 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlock.java @@ -4,7 +4,6 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllFluids; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; -import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.config.AllConfigs;