Skip to content

Commit 4b56e90

Browse files
committed
Fixed collision issues.
1 parent dbb634e commit 4b56e90

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

multipart/src/main/java/sunsetsatellite/catalyst/multipart/block/BlockMultipart.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import net.minecraft.core.util.helper.Side;
1111
import net.minecraft.core.util.phys.AABB;
1212
import net.minecraft.core.world.World;
13+
import sunsetsatellite.catalyst.Catalyst;
1314
import sunsetsatellite.catalyst.CatalystMultipart;
1415
import sunsetsatellite.catalyst.core.util.ISideInteractable;
1516
import sunsetsatellite.catalyst.multipart.api.ISupportsMultiparts;
@@ -82,36 +83,38 @@ public void getCollidingBoundingBoxes(World world, int x, int y, int z, AABB aab
8283
if (((ISupportsMultiparts) tile).getParts().values().stream().allMatch(Objects::isNull)) {
8384
super.getCollidingBoundingBoxes(world, x, y, z, aabb, aabbList);
8485
} else {
86+
8587
((ISupportsMultiparts) tile).getParts().forEach((dir,multipart)->{
8688
if(multipart == null) return;
89+
double d = Catalyst.map(multipart.type.thickness,1,16,0,1);
8790
switch (dir){
8891
case X_POS:{
89-
AABB bb = new AABB(x+1,y,z,(x+1)-((1.0f/16.0f)*multipart.type.thickness),y+1,z+1);
92+
AABB bb = new AABB(x+(1-d),y,z,x+1,y+1,z+1);
9093
aabbList.add(bb);
9194
break;
9295
}
9396
case X_NEG:{
94-
AABB bb = new AABB(x,y,z,x+((1.0f/16.0f)*multipart.type.thickness),y+1,z+1);
97+
AABB bb = new AABB(x,y,z,x+d,y+1,z+1);
9598
aabbList.add(bb);
9699
break;
97100
}
98101
case Y_POS:{
99-
AABB bb = new AABB(x,y+1,z,x+1,(y+1)-((1.0f/16.0f)*multipart.type.thickness),z+1);
102+
AABB bb = new AABB(x,y+(1-d),z,x+1,y+1,z+1);
100103
aabbList.add(bb);
101104
break;
102105
}
103106
case Y_NEG:{
104-
AABB bb = new AABB(x,y,z,x+1,y+((1.0f/16.0f)*multipart.type.thickness),z+1);
107+
AABB bb = new AABB(x,y,z,x+1,y+d,z+1);
105108
aabbList.add(bb);
106109
break;
107110
}
108111
case Z_POS: {
109-
AABB bb = new AABB(x,y,z+1,x+1,y+1,(z+1)-((1.0f/16.0f)*multipart.type.thickness));
112+
AABB bb = new AABB(x,y,z+(1-d),x+1,y+1,z+1);
110113
aabbList.add(bb);
111114
break;
112115
}
113116
case Z_NEG: {
114-
AABB bb = new AABB(x,y,z,x+1,y+1,z+((1.0f/16.0f)*multipart.type.thickness));
117+
AABB bb = new AABB(x,y,z,x+1,y+1,z+d);
115118
aabbList.add(bb);
116119
break;
117120
}

0 commit comments

Comments
 (0)