mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-11 04:22:00 +01:00
Ported #528 to 1.15
This commit is contained in:
parent
f4961e5ede
commit
f9b09c213b
1 changed files with 19 additions and 10 deletions
|
@ -10,6 +10,8 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
||||||
|
|
||||||
import net.minecraft.block.BlockRenderType;
|
import net.minecraft.block.BlockRenderType;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.block.BubbleColumnBlock;
|
||||||
import net.minecraft.fluid.Fluids;
|
import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.fluid.IFluidState;
|
import net.minecraft.fluid.IFluidState;
|
||||||
import net.minecraft.item.BlockItemUseContext;
|
import net.minecraft.item.BlockItemUseContext;
|
||||||
|
@ -80,18 +82,25 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
||||||
updateWheelSpeed(worldIn, pos);
|
updateWheelSpeed(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFlowAt(BlockState state, World world, BlockPos pos, Direction f) {
|
private void updateFlowAt(BlockState state, World world, BlockPos pos, Direction side) {
|
||||||
if (f.getAxis() == state.get(HORIZONTAL_FACING)
|
if (side.getAxis() == state.get(HORIZONTAL_FACING)
|
||||||
.getAxis())
|
.getAxis())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IFluidState fluid = world.getFluidState(pos.offset(f));
|
IFluidState fluid = world.getFluidState(pos.offset(side));
|
||||||
Direction wf = state.get(HORIZONTAL_FACING);
|
Direction wf = state.get(HORIZONTAL_FACING);
|
||||||
boolean clockwise = wf.getAxisDirection() == AxisDirection.POSITIVE;
|
boolean clockwise = wf.getAxisDirection() == AxisDirection.POSITIVE;
|
||||||
int clockwiseMultiplier = 2;
|
int clockwiseMultiplier = 2;
|
||||||
|
|
||||||
Vec3d vec = fluid.getFlow(world, pos.offset(f));
|
Vec3d vec = fluid.getFlow(world, pos.offset(side));
|
||||||
vec = vec.scale(f.getAxisDirection()
|
if (side.getAxis()
|
||||||
|
.isHorizontal()) {
|
||||||
|
BlockState adjacentBlock = world.getBlockState(pos.offset(side));
|
||||||
|
if (adjacentBlock.getBlock() == Blocks.BUBBLE_COLUMN.getBlock())
|
||||||
|
vec = new Vec3d(0, adjacentBlock.get(BubbleColumnBlock.DRAG) ? -1 : 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
vec = vec.scale(side.getAxisDirection()
|
||||||
.getOffset());
|
.getOffset());
|
||||||
vec = new Vec3d(Math.signum(vec.x), Math.signum(vec.y), Math.signum(vec.z));
|
vec = new Vec3d(Math.signum(vec.x), Math.signum(vec.y), Math.signum(vec.z));
|
||||||
Vec3d flow = vec;
|
Vec3d flow = vec;
|
||||||
|
@ -100,16 +109,16 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
||||||
double flowStrength = 0;
|
double flowStrength = 0;
|
||||||
|
|
||||||
if (wf.getAxis() == Axis.Z) {
|
if (wf.getAxis() == Axis.Z) {
|
||||||
if (f.getAxis() == Axis.Y)
|
if (side.getAxis() == Axis.Y)
|
||||||
flowStrength = flow.x > 0 ^ !clockwise ? -flow.x * clockwiseMultiplier : -flow.x;
|
flowStrength = flow.x > 0 ^ !clockwise ? -flow.x * clockwiseMultiplier : -flow.x;
|
||||||
if (f.getAxis() == Axis.X)
|
if (side.getAxis() == Axis.X)
|
||||||
flowStrength = flow.y < 0 ^ !clockwise ? flow.y * clockwiseMultiplier : flow.y;
|
flowStrength = flow.y < 0 ^ !clockwise ? flow.y * clockwiseMultiplier : flow.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wf.getAxis() == Axis.X) {
|
if (wf.getAxis() == Axis.X) {
|
||||||
if (f.getAxis() == Axis.Y)
|
if (side.getAxis() == Axis.Y)
|
||||||
flowStrength = flow.z < 0 ^ !clockwise ? flow.z * clockwiseMultiplier : flow.z;
|
flowStrength = flow.z < 0 ^ !clockwise ? flow.z * clockwiseMultiplier : flow.z;
|
||||||
if (f.getAxis() == Axis.Z)
|
if (side.getAxis() == Axis.Z)
|
||||||
flowStrength = flow.y > 0 ^ !clockwise ? -flow.y * clockwiseMultiplier : -flow.y;
|
flowStrength = flow.y > 0 ^ !clockwise ? -flow.y * clockwiseMultiplier : -flow.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +129,7 @@ public class WaterWheelBlock extends HorizontalKineticBlock implements ITE<Water
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer flowModifier = AllConfigs.SERVER.kinetics.waterWheelFlowSpeed.get();
|
Integer flowModifier = AllConfigs.SERVER.kinetics.waterWheelFlowSpeed.get();
|
||||||
te.setFlow(f, (float) (flowStrength * flowModifier / 2f));
|
te.setFlow(side, (float) (flowStrength * flowModifier / 2f));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue