mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-31 17:36:43 +01:00
get horizontal water wheels ready for 1.16
This commit is contained in:
commit
b2e3fe6fd1
6 changed files with 35 additions and 19 deletions
|
@ -388,7 +388,7 @@ a8094531617e27a545c4815ab2062bf0ffca3633 assets/create/blockstates/turntable.jso
|
||||||
c4db76b9d36cfb098df0d158cb6f8b82768ebe14 assets/create/blockstates/vertical_framed_glass_pane.json
|
c4db76b9d36cfb098df0d158cb6f8b82768ebe14 assets/create/blockstates/vertical_framed_glass_pane.json
|
||||||
3a5da54d9763e9512cfaa47b25226b79738b25f3 assets/create/blockstates/warped_window.json
|
3a5da54d9763e9512cfaa47b25226b79738b25f3 assets/create/blockstates/warped_window.json
|
||||||
19ef7a16c82f07d304fb60d121845185d189aecf assets/create/blockstates/warped_window_pane.json
|
19ef7a16c82f07d304fb60d121845185d189aecf assets/create/blockstates/warped_window_pane.json
|
||||||
d995547bcd71603ba7378d8998098e462030bfd0 assets/create/blockstates/water_wheel.json
|
d31fce8315c8715521d66b5dcc166c84e949dd1d assets/create/blockstates/water_wheel.json
|
||||||
f182669f7547964f9f2ef67916568556870def7b assets/create/blockstates/weathered_limestone.json
|
f182669f7547964f9f2ef67916568556870def7b assets/create/blockstates/weathered_limestone.json
|
||||||
27e6740834c0f673acc3531371512daa6dcab025 assets/create/blockstates/weathered_limestone_bricks.json
|
27e6740834c0f673acc3531371512daa6dcab025 assets/create/blockstates/weathered_limestone_bricks.json
|
||||||
abb74e4f4c2b9851670cb6ad794281b0f7be0f5a assets/create/blockstates/weathered_limestone_bricks_slab.json
|
abb74e4f4c2b9851670cb6ad794281b0f7be0f5a assets/create/blockstates/weathered_limestone_bricks_slab.json
|
||||||
|
@ -1668,7 +1668,7 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear
|
||||||
a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json
|
a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json
|
||||||
b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json
|
b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json
|
||||||
bbe7fc4aef29420319f59d02d4cd376a78244e70 assets/create/sounds.json
|
bbe7fc4aef29420319f59d02d4cd376a78244e70 assets/create/sounds.json
|
||||||
0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json
|
5d0cc4c0255dc241e61c173b31ddca70c88d08e4 data/create/advancements/aesthetics.json
|
||||||
187921fa131b06721bfaf63f2623a28c141aae9a data/create/advancements/andesite_alloy.json
|
187921fa131b06721bfaf63f2623a28c141aae9a data/create/advancements/andesite_alloy.json
|
||||||
0ea2db7173b5be28b289ea7c9a6a0cf5805c60c7 data/create/advancements/andesite_casing.json
|
0ea2db7173b5be28b289ea7c9a6a0cf5805c60c7 data/create/advancements/andesite_casing.json
|
||||||
83c046bd200623933545c9e4326f782fb02c87fa data/create/advancements/arm_blaze_burner.json
|
83c046bd200623933545c9e4326f782fb02c87fa data/create/advancements/arm_blaze_burner.json
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
{
|
{
|
||||||
"variants": {
|
"variants": {
|
||||||
|
"facing=down": {
|
||||||
|
"model": "create:block/water_wheel",
|
||||||
|
"x": 180
|
||||||
|
},
|
||||||
|
"facing=up": {
|
||||||
|
"model": "create:block/water_wheel"
|
||||||
|
},
|
||||||
"facing=north": {
|
"facing=north": {
|
||||||
"model": "create:block/water_wheel",
|
"model": "create:block/water_wheel",
|
||||||
"x": 90
|
"x": 90
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
"trigger": "create:bracket_apply",
|
"trigger": "create:bracket_apply",
|
||||||
"conditions": {
|
"conditions": {
|
||||||
"accepted_entries": [
|
"accepted_entries": [
|
||||||
"create:cogwheel",
|
"create:large_cogwheel",
|
||||||
"create:large_cogwheel"
|
"create:cogwheel"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -368,8 +368,8 @@ public class AllBlocks {
|
||||||
|
|
||||||
public static final BlockEntry<WaterWheelBlock> WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new)
|
public static final BlockEntry<WaterWheelBlock> WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new)
|
||||||
.initialProperties(SharedProperties::wooden)
|
.initialProperties(SharedProperties::wooden)
|
||||||
.properties(AbstractBlock.Properties::nonOpaque)
|
.properties(Block.Properties::nonOpaque)
|
||||||
.blockstate(BlockStateGen.horizontalWheelProvider(false))
|
.blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(false))
|
||||||
.addLayer(() -> RenderType::getCutoutMipped)
|
.addLayer(() -> RenderType::getCutoutMipped)
|
||||||
.transform(StressConfigDefaults.setCapacity(16.0))
|
.transform(StressConfigDefaults.setCapacity(16.0))
|
||||||
.simpleItem()
|
.simpleItem()
|
||||||
|
|
|
@ -5,7 +5,7 @@ import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllFluids;
|
import com.simibubi.create.AllFluids;
|
||||||
import com.simibubi.create.AllTileEntities;
|
import com.simibubi.create.AllTileEntities;
|
||||||
import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock;
|
import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock;
|
||||||
import com.simibubi.create.foundation.advancement.AllTriggers;
|
import com.simibubi.create.foundation.advancement.AllTriggers;
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
|
@ -33,7 +33,7 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<WaterWheelTileEntity> {
|
public class WaterWheelBlock extends DirectionalKineticBlock implements ITE<WaterWheelTileEntity> {
|
||||||
|
|
||||||
public WaterWheelBlock(Properties properties) {
|
public WaterWheelBlock(Properties properties) {
|
||||||
super(properties);
|
super(properties);
|
||||||
|
@ -56,10 +56,10 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
||||||
BlockState neighbourState = worldIn.getBlockState(neighbourPos);
|
BlockState neighbourState = worldIn.getBlockState(neighbourPos);
|
||||||
if (!AllBlocks.WATER_WHEEL.has(neighbourState))
|
if (!AllBlocks.WATER_WHEEL.has(neighbourState))
|
||||||
continue;
|
continue;
|
||||||
if (neighbourState.get(HORIZONTAL_FACING)
|
if (neighbourState.get(FACING)
|
||||||
.getAxis() != state.get(HORIZONTAL_FACING)
|
.getAxis() != state.get(FACING)
|
||||||
.getAxis()
|
.getAxis()
|
||||||
|| state.get(HORIZONTAL_FACING)
|
|| state.get(FACING)
|
||||||
.getAxis() != direction.getAxis())
|
.getAxis() != direction.getAxis())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -88,13 +88,14 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
||||||
updateWheelSpeed(worldIn, pos);
|
updateWheelSpeed(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void updateFlowAt(BlockState state, IWorld world, BlockPos pos, Direction side) {
|
private void updateFlowAt(BlockState state, IWorld world, BlockPos pos, Direction side) {
|
||||||
if (side.getAxis() == state.get(HORIZONTAL_FACING)
|
if (side.getAxis() == state.get(FACING)
|
||||||
.getAxis())
|
.getAxis())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FluidState fluid = world.getFluidState(pos.offset(side));
|
FluidState fluid = world.getFluidState(pos.offset(side));
|
||||||
Direction wf = state.get(HORIZONTAL_FACING);
|
Direction wf = state.get(FACING);
|
||||||
boolean clockwise = wf.getAxisDirection() == AxisDirection.POSITIVE;
|
boolean clockwise = wf.getAxisDirection() == AxisDirection.POSITIVE;
|
||||||
int clockwiseMultiplier = 2;
|
int clockwiseMultiplier = 2;
|
||||||
|
|
||||||
|
@ -128,6 +129,14 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
||||||
flowStrength = flow.y > 0 ^ !clockwise ? -flow.y * clockwiseMultiplier : -flow.y;
|
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()) {
|
if (te.getSpeed() == 0 && flowStrength != 0 && !world.isRemote()) {
|
||||||
AllTriggers.triggerForNearbyPlayers(AllTriggers.WATER_WHEEL, world, pos, 5);
|
AllTriggers.triggerForNearbyPlayers(AllTriggers.WATER_WHEEL, world, pos, 5);
|
||||||
if (FluidHelper.isLava(fluid.getFluid()))
|
if (FluidHelper.isLava(fluid.getFluid()))
|
||||||
|
@ -152,23 +161,23 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
||||||
.getBlockState(context.getPos()
|
.getBlockState(context.getPos()
|
||||||
.offset(facing.getOpposite()));
|
.offset(facing.getOpposite()));
|
||||||
if (AllBlocks.WATER_WHEEL.has(placedOn))
|
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()
|
if (facing.getAxis()
|
||||||
.isHorizontal())
|
.isHorizontal())
|
||||||
return getDefaultState().with(HORIZONTAL_FACING, context.getPlayer() != null && context.getPlayer()
|
return getDefaultState().with(FACING, context.getPlayer() != null && context.getPlayer()
|
||||||
.isSneaking() ? facing.getOpposite() : facing);
|
.isSneaking() ? facing.getOpposite() : facing);
|
||||||
return super.getStateForPlacement(context);
|
return super.getStateForPlacement(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
|
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) {
|
||||||
return state.get(HORIZONTAL_FACING)
|
return state.get(FACING)
|
||||||
.getAxis() == face.getAxis();
|
.getAxis() == face.getAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Axis getRotationAxis(BlockState state) {
|
public Axis getRotationAxis(BlockState state) {
|
||||||
return state.get(HORIZONTAL_FACING)
|
return state.get(FACING)
|
||||||
.getAxis();
|
.getAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -595,7 +595,7 @@ public class KineticsScenes {
|
||||||
scene.idle(10);
|
scene.idle(10);
|
||||||
scene.world.rotateSection(wheelElement, 0, 180, 0, 5);
|
scene.world.rotateSection(wheelElement, 0, 180, 0, 5);
|
||||||
scene.idle(10);
|
scene.idle(10);
|
||||||
scene.world.modifyBlock(wheel, s -> s.with(WaterWheelBlock.HORIZONTAL_FACING, Direction.WEST), false);
|
scene.world.modifyBlock(wheel, s -> s.with(WaterWheelBlock.FACING, Direction.WEST), false);
|
||||||
scene.world.rotateSection(wheelElement, 0, -180, 0, 0);
|
scene.world.rotateSection(wheelElement, 0, -180, 0, 0);
|
||||||
scene.idle(1);
|
scene.idle(1);
|
||||||
scene.world.moveSection(water, util.vector.of(0, -2, 2), 10);
|
scene.world.moveSection(water, util.vector.of(0, -2, 2), 10);
|
||||||
|
@ -618,7 +618,7 @@ public class KineticsScenes {
|
||||||
scene.rotateCameraY(30);
|
scene.rotateCameraY(30);
|
||||||
scene.world.rotateSection(wheelElement, 0, 180, 0, 5);
|
scene.world.rotateSection(wheelElement, 0, 180, 0, 5);
|
||||||
scene.idle(10);
|
scene.idle(10);
|
||||||
scene.world.modifyBlock(wheel, s -> s.with(WaterWheelBlock.HORIZONTAL_FACING, Direction.EAST), false);
|
scene.world.modifyBlock(wheel, s -> s.with(WaterWheelBlock.FACING, Direction.EAST), false);
|
||||||
scene.world.rotateSection(wheelElement, 0, -180, 0, 0);
|
scene.world.rotateSection(wheelElement, 0, -180, 0, 0);
|
||||||
scene.idle(1);
|
scene.idle(1);
|
||||||
scene.world.moveSection(water, util.vector.of(0, -2, 2), 10);
|
scene.world.moveSection(water, util.vector.of(0, -2, 2), 10);
|
||||||
|
|
Loading…
Reference in a new issue