1
1
package net .caffeinemc .mods .lithium .fabric .mixin .entity .collisions .fluid ;
2
2
3
+ import com .llamalad7 .mixinextras .sugar .Local ;
3
4
import it .unimi .dsi .fastutil .objects .Object2DoubleMap ;
4
5
import net .caffeinemc .mods .lithium .common .block .BlockCountingSection ;
5
6
import net .caffeinemc .mods .lithium .common .block .BlockStateFlags ;
6
7
import net .caffeinemc .mods .lithium .common .block .TrackedBlockStatePredicate ;
7
8
import net .caffeinemc .mods .lithium .common .entity .FluidCachingEntity ;
8
9
import net .caffeinemc .mods .lithium .common .util .Pos ;
10
+ import net .minecraft .client .multiplayer .ClientLevel ;
11
+ import net .minecraft .server .level .ServerLevel ;
9
12
import net .minecraft .tags .FluidTags ;
10
13
import net .minecraft .tags .TagKey ;
11
14
import net .minecraft .world .entity .Entity ;
12
15
import net .minecraft .world .level .Level ;
13
16
import net .minecraft .world .level .chunk .ChunkAccess ;
14
17
import net .minecraft .world .level .chunk .LevelChunkSection ;
15
18
import net .minecraft .world .level .material .Fluid ;
16
- import net .minecraft .world .phys .AABB ;
17
19
import org .spongepowered .asm .mixin .Mixin ;
18
20
import org .spongepowered .asm .mixin .Shadow ;
19
21
import org .spongepowered .asm .mixin .injection .At ;
20
22
import org .spongepowered .asm .mixin .injection .Inject ;
21
23
import org .spongepowered .asm .mixin .injection .callback .CallbackInfoReturnable ;
22
- import org .spongepowered .asm .mixin .injection .callback .LocalCapture ;
23
24
24
25
@ Mixin (Entity .class )
25
26
public abstract class EntityMixin implements FluidCachingEntity {
@@ -34,13 +35,16 @@ public abstract class EntityMixin implements FluidCachingEntity {
34
35
method = "updateFluidHeightAndDoFluidPushing" ,
35
36
at = @ At (
36
37
value = "INVOKE" ,
37
- target = "Lnet/minecraft/world/entity/Entity;isPushedByFluid()Z" ,
38
- shift = At .Shift .BEFORE
38
+ target = "Lnet/minecraft/world/entity/Entity;isPushedByFluid()Z"
39
39
),
40
- cancellable = true ,
41
- locals = LocalCapture .CAPTURE_FAILHARD
40
+ cancellable = true
42
41
)
43
- public void tryShortcutFluidPushing (TagKey <Fluid > tag , double speed , CallbackInfoReturnable <Boolean > cir , AABB box , int x1 , int x2 , int y1 , int y2 , int z1 , int z2 , double zero ) {
42
+ public void tryShortcutFluidPushing (TagKey <Fluid > tag , double speed , CallbackInfoReturnable <Boolean > cir , @ Local (ordinal = 0 ) int x1 , @ Local (ordinal = 1 ) int x2 , @ Local (ordinal = 2 ) int y1 , @ Local (ordinal = 3 ) int y2 , @ Local (ordinal = 4 ) int z1 , @ Local (ordinal = 5 ) int z2 ) {
43
+ if (!(this .level instanceof ClientLevel || this .level instanceof ServerLevel )) {
44
+ //Create compatibility: Directly accessing the chunk sections is not compatible with Create Ponder level, which subclass neither client nor server levels
45
+ return ;
46
+ }
47
+
44
48
TrackedBlockStatePredicate blockStateFlag ;
45
49
if (tag == FluidTags .WATER ) {
46
50
blockStateFlag = BlockStateFlags .WATER ;
0 commit comments