Cache x coordinate multiplier for CollisionUtil#sliceShapeOptimised
This is consistent with how the rest of the collision patch iterates the voxel bitset.
This commit is contained in:
@@ -103,8 +103,8 @@ public abstract class PoiManagerMixin extends SectionStorage<Object> implements
|
||||
*/
|
||||
@Overwrite
|
||||
public int sectionsToVillage(final SectionPos pos) {
|
||||
this.villageDistanceTracker.propagateUpdates(); // Paper - replace distance tracking util
|
||||
return convertBetweenLevels(this.villageDistanceTracker.getLevel(CoordinateUtils.getChunkSectionKey(pos))); // Paper - replace distance tracking util
|
||||
this.villageDistanceTracker.propagateUpdates();
|
||||
return convertBetweenLevels(this.villageDistanceTracker.getLevel(CoordinateUtils.getChunkSectionKey(pos)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -331,13 +331,15 @@ public final class CollisionUtil {
|
||||
|
||||
final BitSetDiscreteVoxelShape shape = new BitSetDiscreteVoxelShape(local_len_x, local_len_y, local_len_z);
|
||||
|
||||
final int idx_off = shape_sz + shape_sy*size_z + shape_sx*(size_z*size_y);
|
||||
final int bitset_mul_x = size_z*size_y;
|
||||
final int idx_off = shape_sz + shape_sy*size_z + shape_sx*bitset_mul_x;
|
||||
final int shape_mul_x = local_len_y*local_len_z;
|
||||
for (int x = 0; x < local_len_x; ++x) {
|
||||
boolean setX = false;
|
||||
for (int y = 0; y < local_len_y; ++y) {
|
||||
boolean setY = false;
|
||||
for (int z = 0; z < local_len_z; ++z) {
|
||||
final int unslicedIdx = idx_off + z + y*size_z + x*(size_z*size_y);
|
||||
final int unslicedIdx = idx_off + z + y*size_z + x*bitset_mul_x;
|
||||
if ((bitset[unslicedIdx >>> 6] & (1L << unslicedIdx)) == 0L) {
|
||||
continue;
|
||||
}
|
||||
@@ -348,7 +350,7 @@ public final class CollisionUtil {
|
||||
shape.zMax = Math.max(shape.zMax, z + 1);
|
||||
|
||||
shape.storage.set(
|
||||
z + y*local_len_z + x*(local_len_y*local_len_z)
|
||||
z + y*local_len_z + x*shape_mul_x
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user