13
0
geforkt von Mirrors/Paper

Configurable speed for water flowing over lava

Dieser Commit ist enthalten in:
Byteflux 2018-08-08 16:33:21 -06:00
Ursprung 14aa197675
Commit 28ea7bb560

Datei anzeigen

@ -9,7 +9,49 @@
if (fluidtype instanceof FlowingFluid fluidtypeflowing) { if (fluidtype instanceof FlowingFluid fluidtypeflowing) {
dataresult = DataResult.success(fluidtypeflowing); dataresult = DataResult.success(fluidtypeflowing);
@@ -175,14 +175,20 @@ @@ -141,11 +141,31 @@
@Override
protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
if (this.shouldSpreadLiquid(world, pos, state)) {
- world.scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay(world));
+ world.scheduleTick(pos, state.getFluidState().getType(), this.getFlowSpeed(world, pos)); // Paper - Configurable speed for water flowing over lava
}
}
+ // Paper start - Configurable speed for water flowing over lava
+ public int getFlowSpeed(Level world, BlockPos blockposition) {
+ if (net.minecraft.core.registries.BuiltInRegistries.FLUID.wrapAsHolder(this.fluid).is(FluidTags.WATER)) {
+ if (
+ isLava(world, blockposition.north(1)) ||
+ isLava(world, blockposition.south(1)) ||
+ isLava(world, blockposition.west(1)) ||
+ isLava(world, blockposition.east(1))
+ ) {
+ return world.paperConfig().environment.waterOverLavaFlowSpeed;
+ }
+ }
+ return this.fluid.getTickDelay(world);
+ }
+ private static boolean isLava(Level world, BlockPos blockPos) {
+ final FluidState fluidState = world.getFluidIfLoaded(blockPos);
+ return fluidState != null && fluidState.is(FluidTags.LAVA);
+ }
+ // Paper end - Configurable speed for water flowing over lava
+
@Override
protected BlockState updateShape(BlockState state, LevelReader world, ScheduledTickAccess tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, RandomSource random) {
if (state.getFluidState().isSource() || neighborState.getFluidState().isSource()) {
@@ -158,7 +178,7 @@
@Override
protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) {
if (this.shouldSpreadLiquid(world, pos, state)) {
- world.scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay(world));
+ world.scheduleTick(pos, state.getFluidState().getType(), this.getFlowSpeed(world, pos)); // Paper - Configurable speed for water flowing over lava
}
}
@@ -175,14 +195,20 @@
if (world.getFluidState(blockposition1).is(FluidTags.WATER)) { if (world.getFluidState(blockposition1).is(FluidTags.WATER)) {
Block block = world.getFluidState(pos).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE; Block block = world.getFluidState(pos).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;