aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/ClipContext.java.patch
blob: b1405c93543192c890373c6d251583a931b6147b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
--- a/net/minecraft/world/level/ClipContext.java
+++ b/net/minecraft/world/level/ClipContext.java
@@ -6,7 +6,7 @@
 import net.minecraft.tags.FluidTags;
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.level.block.state.BlockBehaviour;
-import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.world.level.block.state.IBlockData;
 import net.minecraft.world.level.material.FluidState;
 import net.minecraft.world.phys.Vec3;
 import net.minecraft.world.phys.shapes.CollisionContext;
@@ -14,6 +14,7 @@
 import net.minecraft.world.phys.shapes.VoxelShape;
 
 public class ClipContext {
+
     private final Vec3 from;
     private final Vec3 to;
     private final ClipContext.Block block;
@@ -21,15 +22,15 @@
     private final CollisionContext collisionContext;
 
     public ClipContext(Vec3 from, Vec3 to, ClipContext.Block block, ClipContext.Fluid fluid, Entity entity) {
-        this(from, to, block, fluid, CollisionContext.of(entity));
+        this(from, to, block, fluid, (entity == null) ? CollisionContext.empty() : CollisionContext.of(entity)); // CraftBukkit
     }
 
-    public ClipContext(Vec3 vec3, Vec3 vec31, ClipContext.Block block, ClipContext.Fluid fluid, CollisionContext collisionContext) {
-        this.from = vec3;
-        this.to = vec31;
-        this.block = block;
-        this.fluid = fluid;
-        this.collisionContext = collisionContext;
+    public ClipContext(Vec3 vec3d, Vec3 vec3d1, ClipContext.Block raytrace_blockcollisionoption, ClipContext.Fluid raytrace_fluidcollisionoption, CollisionContext voxelshapecollision) {
+        this.from = vec3d;
+        this.to = vec3d1;
+        this.block = raytrace_blockcollisionoption;
+        this.fluid = raytrace_fluidcollisionoption;
+        this.collisionContext = voxelshapecollision;
     }
 
     public Vec3 getTo() {
@@ -40,7 +41,7 @@
         return this.from;
     }
 
-    public VoxelShape getBlockShape(BlockState blockState, BlockGetter level, BlockPos pos) {
+    public VoxelShape getBlockShape(IBlockData blockState, BlockGetter level, BlockPos pos) {
         return this.block.get(blockState, level, pos, this.collisionContext);
     }
 
@@ -49,33 +50,37 @@
     }
 
     public static enum Block implements ClipContext.ShapeGetter {
-        COLLIDER(BlockBehaviour.BlockStateBase::getCollisionShape),
-        OUTLINE(BlockBehaviour.BlockStateBase::getShape),
-        VISUAL(BlockBehaviour.BlockStateBase::getVisualShape),
-        FALLDAMAGE_RESETTING((state, block, pos, collisionContext) -> state.is(BlockTags.FALL_DAMAGE_RESETTING) ? Shapes.block() : Shapes.empty());
 
+        COLLIDER(BlockBehaviour.BlockStateBase::getCollisionShape), OUTLINE(BlockBehaviour.BlockStateBase::getShape), VISUAL(BlockBehaviour.BlockStateBase::getVisualShape), FALLDAMAGE_RESETTING((iblockdata, iblockaccess, blockposition, voxelshapecollision) -> {
+            return iblockdata.is(BlockTags.FALL_DAMAGE_RESETTING) ? Shapes.block() : Shapes.empty();
+        });
+
         private final ClipContext.ShapeGetter shapeGetter;
 
-        private Block(ClipContext.ShapeGetter shapeGetter) {
-            this.shapeGetter = shapeGetter;
+        private Block(ClipContext.ShapeGetter raytrace_c) {
+            this.shapeGetter = raytrace_c;
         }
 
         @Override
-        public VoxelShape get(BlockState state, BlockGetter block, BlockPos pos, CollisionContext collisionContext) {
+        public VoxelShape get(IBlockData state, BlockGetter block, BlockPos pos, CollisionContext collisionContext) {
             return this.shapeGetter.get(state, block, pos, collisionContext);
         }
     }
 
     public static enum Fluid {
-        NONE(fluid -> false),
-        SOURCE_ONLY(FluidState::isSource),
-        ANY(fluid -> !fluid.isEmpty()),
-        WATER(fluid -> fluid.is(FluidTags.WATER));
 
+        NONE((fluid) -> {
+            return false;
+        }), SOURCE_ONLY(FluidState::isSource), ANY((fluid) -> {
+            return !fluid.isEmpty();
+        }), WATER((fluid) -> {
+            return fluid.is(FluidTags.WATER);
+        });
+
         private final Predicate<FluidState> canPick;
 
-        private Fluid(Predicate<FluidState> canPick) {
-            this.canPick = canPick;
+        private Fluid(Predicate<FluidState> predicate) { // CraftBukkit - decompile error
+            this.canPick = predicate;
         }
 
         public boolean canPick(FluidState state) {
@@ -84,6 +89,7 @@
     }
 
     public interface ShapeGetter {
-        VoxelShape get(BlockState state, BlockGetter block, BlockPos pos, CollisionContext collisionContext);
+
+        VoxelShape get(IBlockData state, BlockGetter block, BlockPos pos, CollisionContext collisionContext);
     }
 }