3
3
import com .ryorama .terrariamod .TerrariaMod ;
4
4
import com .ryorama .terrariamod .fluids .FlowLava ;
5
5
import com .ryorama .terrariamod .fluids .FlowWater ;
6
- import net .minecraft .block . BlockState ;
7
- import net .minecraft .fluid .* ;
8
- import net .minecraft .util . math . BlockPos ;
9
- import net .minecraft .util . math . Direction ;
10
- import net .minecraft .world .BlockView ;
11
- import net .minecraft .world .World ;
12
- import net .minecraft .world .WorldAccess ;
6
+ import net .minecraft .core . BlockPos ;
7
+ import net .minecraft .core . Direction ;
8
+ import net .minecraft .world . level . BlockGetter ;
9
+ import net .minecraft .world . level . Level ;
10
+ import net .minecraft .world .level . LevelAccessor ;
11
+ import net .minecraft .world .level . block . state . BlockState ;
12
+ import net .minecraft .world .level . material .* ;
13
13
import org .spongepowered .asm .mixin .Mixin ;
14
14
import org .spongepowered .asm .mixin .injection .At ;
15
15
import org .spongepowered .asm .mixin .injection .Inject ;
16
16
import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
17
17
import org .spongepowered .asm .mixin .injection .callback .CallbackInfoReturnable ;
18
18
19
- @ Mixin (FlowableFluid .class )
19
+ @ Mixin (FlowingFluid .class )
20
20
public abstract class FlowingMixin extends Fluid {
21
21
22
- @ Inject (at = @ At ("HEAD" ), method = "canFlowThrough " , cancellable = true )
23
- private void canFlowThrough ( BlockView world , Fluid fluid , BlockPos pos , BlockState state , Direction face , BlockPos fromPos , BlockState fromState , FluidState fluidState , CallbackInfoReturnable <Boolean > bruh ) {
22
+ @ Inject (at = @ At ("HEAD" ), method = "canPassThrough " , cancellable = true )
23
+ private void canPassThrough ( BlockGetter world , Fluid fluid , BlockPos pos , BlockState state , Direction face , BlockPos fromPos , BlockState fromState , FluidState fluidState , CallbackInfoReturnable <Boolean > bruh ) {
24
24
if (!TerrariaMod .CONFIG .useVanillaFluidPhysics ) {
25
25
if (fluid instanceof WaterFluid || fluid instanceof LavaFluid ) {
26
26
bruh .setReturnValue (false );
27
27
}
28
28
}
29
29
}
30
30
31
- @ Inject (at = @ At ("HEAD" ), method = "canFlow " , cancellable = true )
32
- private void canFlow ( BlockView world , BlockPos fluidPos , BlockState fluidBlockState , Direction flowDirection , BlockPos flowTo , BlockState flowToBlockState , FluidState fluidState , Fluid fluid , CallbackInfoReturnable <Boolean > bruh ) {
31
+ @ Inject (at = @ At ("HEAD" ), method = "canSpreadTo " , cancellable = true )
32
+ private void canSpreadTo ( BlockGetter world , BlockPos fluidPos , BlockState fluidBlockState , Direction flowDirection , BlockPos flowTo , BlockState flowToBlockState , FluidState fluidState , Fluid fluid , CallbackInfoReturnable <Boolean > bruh ) {
33
33
if (!TerrariaMod .CONFIG .useVanillaFluidPhysics ) {
34
34
if (fluid instanceof WaterFluid || fluid instanceof LavaFluid ) {
35
35
bruh .setReturnValue (false );
36
36
}
37
37
}
38
38
}
39
39
40
- @ Inject (at = @ At ("HEAD" ), method = "tryFlow " , cancellable = true )
41
- private void tryFlow ( World world , BlockPos fluidPos , FluidState state , CallbackInfo info ) {
40
+ @ Inject (at = @ At ("HEAD" ), method = "spread " , cancellable = true )
41
+ private void spread ( Level world , BlockPos fluidPos , FluidState state , CallbackInfo info ) {
42
42
if (!TerrariaMod .CONFIG .useVanillaFluidPhysics ) {
43
- if ((state .getFluid () instanceof WaterFluid .Flowing || state .getFluid () instanceof LavaFluid .Flowing || (state .getFluid () instanceof WaterFluid .Still || state .getFluid () instanceof LavaFluid .Still ))) {
44
- if (state .getFluid () instanceof WaterFluid ) {
43
+ if ((state .getType () instanceof WaterFluid .Flowing || state .getType () instanceof LavaFluid .Flowing || (state .getType () instanceof WaterFluid .Source || state .getType () instanceof LavaFluid .Source ))) {
44
+ if (state .getType () instanceof WaterFluid ) {
45
45
FlowWater .flowwater (world , fluidPos , state );
46
- } else if (state .getFluid () instanceof LavaFluid ) {
46
+ } else if (state .getType () instanceof LavaFluid ) {
47
47
FlowLava .flowlava (world , fluidPos , state );
48
48
}
49
49
@@ -52,23 +52,23 @@ private void tryFlow(World world, BlockPos fluidPos, FluidState state, CallbackI
52
52
}
53
53
}
54
54
55
- @ Inject (at = @ At ("HEAD" ), method = "getUpdatedState " , cancellable = true )
56
- private void getUpdatedState ( World world , BlockPos pos , BlockState state , CallbackInfoReturnable <FluidState > info ) {
55
+ @ Inject (at = @ At ("HEAD" ), method = "getNewLiquid " , cancellable = true )
56
+ private void getNewLiquid ( Level world , BlockPos pos , BlockState state , CallbackInfoReturnable <FluidState > info ) {
57
57
if (!TerrariaMod .CONFIG .useVanillaFluidPhysics ) {
58
58
FluidState fluidstate = state .getFluidState ();
59
- if (fluidstate .getFluid () instanceof WaterFluid .Flowing || fluidstate .getFluid () instanceof LavaFluid .Flowing ) {
59
+ if (fluidstate .getType () instanceof WaterFluid .Flowing || fluidstate .getType () instanceof LavaFluid .Flowing ) {
60
60
61
- if (fluidstate .getFluid () instanceof WaterFluid ) {
62
- info .setReturnValue (Fluids .FLOWING_WATER .getFlowing (state .getFluidState ().getLevel (), false ));
63
- } else if (fluidstate .getFluid () instanceof LavaFluid ) {
64
- info .setReturnValue (Fluids .FLOWING_LAVA .getFlowing (state .getFluidState ().getLevel (), false ));
61
+ if (fluidstate .getType () instanceof WaterFluid ) {
62
+ info .setReturnValue (Fluids .FLOWING_WATER .getFlowing (state .getFluidState ().getAmount (), false ));
63
+ } else if (fluidstate .getType () instanceof LavaFluid ) {
64
+ info .setReturnValue (Fluids .FLOWING_LAVA .getFlowing (state .getFluidState ().getAmount (), false ));
65
65
}
66
66
}
67
67
}
68
68
}
69
69
70
- @ Inject (at = @ At ("HEAD" ), method = "flow " , cancellable = true )
71
- public void flow ( WorldAccess world , BlockPos pos , BlockState state , Direction direction , FluidState fluidState , CallbackInfo ci ) {
70
+ @ Inject (at = @ At ("HEAD" ), method = "spreadTo " , cancellable = true )
71
+ public void spreadTo ( LevelAccessor world , BlockPos pos , BlockState state , Direction direction , FluidState fluidState , CallbackInfo ci ) {
72
72
if (!TerrariaMod .CONFIG .useVanillaFluidPhysics ) {
73
73
if (direction == Direction .DOWN ) {
74
74
FluidState fluidState2 = world .getFluidState (pos );
@@ -79,8 +79,4 @@ public void flow(WorldAccess world, BlockPos pos, BlockState state, Direction di
79
79
}
80
80
}
81
81
}
82
-
83
- private void playExtinguishEvent (WorldAccess world , BlockPos pos ) {
84
- world .syncWorldEvent (1501 , pos , 0 );
85
- }
86
82
}
0 commit comments