Turbines- I mean horizontal water wheels

- Make water wheels work and be able to be placed horizontally
This commit is contained in:
_0Steven 2021-02-22 13:09:50 +01:00
parent da09112e3c
commit 33a08a235e
5 changed files with 112 additions and 97 deletions

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -335,7 +335,7 @@ public class AllBlocks {
public static final BlockEntry<WaterWheelBlock> 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()

View file

@ -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<WaterWheelTileEntity> {
public class WaterWheelBlock extends DirectionalKineticBlock implements ITE<WaterWheelTileEntity> {
public WaterWheelBlock(Properties properties) {
super(properties);
@ -51,10 +52,10 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
BlockState neighbourState = worldIn.getBlockState(neighbourPos);
if (!AllBlocks.WATER_WHEEL.has(neighbourState))
continue;
if (neighbourState.get(HORIZONTAL_FACING)
.getAxis() != state.get(HORIZONTAL_FACING)
if (neighbourState.get(FACING)
.getAxis() != state.get(FACING)
.getAxis()
|| state.get(HORIZONTAL_FACING)
|| state.get(FACING)
.getAxis() != direction.getAxis())
return false;
}
@ -85,12 +86,12 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
}
private void updateFlowAt(BlockState state, World world, BlockPos pos, Direction side) {
if (side.getAxis() == state.get(HORIZONTAL_FACING)
if (side.getAxis() == state.get(FACING)
.getAxis())
return;
IFluidState fluid = world.getFluidState(pos.offset(side));
Direction wf = state.get(HORIZONTAL_FACING);
Direction wf = state.get(FACING);
boolean clockwise = wf.getAxisDirection() == AxisDirection.POSITIVE;
int clockwiseMultiplier = 2;
@ -124,6 +125,13 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
flowStrength = flow.y > 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<Water
.getBlockState(context.getPos()
.offset(facing.getOpposite()));
if (AllBlocks.WATER_WHEEL.has(placedOn))
return getDefaultState().with(HORIZONTAL_FACING, placedOn.get(HORIZONTAL_FACING));
return getDefaultState().with(FACING, placedOn.get(FACING));
if (facing.getAxis()
.isHorizontal())
return getDefaultState().with(HORIZONTAL_FACING, context.getPlayer() != null && context.getPlayer()
return getDefaultState().with(FACING, context.getPlayer() != null && context.getPlayer()
.isSneaking() ? facing.getOpposite() : facing);
return super.getStateForPlacement(context);
}
@Override
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
return state.get(HORIZONTAL_FACING)
return state.get(FACING)
.getAxis() == face.getAxis();
}
@Override
public Axis getRotationAxis(BlockState state) {
return state.get(HORIZONTAL_FACING)
return state.get(FACING)
.getAxis();
}