@@ -102,7 +102,9 @@ private static void clear() {
102102 synchronized (HIT_POINTS ) {
103103 HIT_POINTS .clear ();
104104 }
105- DebugRayTrace .rays .clear ();
105+ synchronized (DebugRayTrace .rays ) {
106+ DebugRayTrace .rays .clear ();
107+ }
106108 SOURCE_AUDIO_DATA_CACHE .clear ();
107109 }
108110
@@ -150,11 +152,13 @@ private static void generateOneRay(Vec3 earPos, Vector3d ray, ClientLevel level,
150152 HIT_POINTS .add (new HitPoint (round , new Vec3 (hitPos .x , hitPos .y , hitPos .z ), journey , distance , BlockSoundProperty .get (soundType ), hitResult .getDirection ()));
151153 }
152154 if (debug ) {
153- DebugRayTrace .rays .add (new DebugRayTrace .Ray (
154- new Vec3 (startPos .x , startPos .y , startPos .z ),
155- new Vec3 (startPos .x + ray .x * distance , startPos .y + ray .y * distance , startPos .z + ray .z * distance ),
156- color
157- ));
155+ synchronized (DebugRayTrace .rays ) {
156+ DebugRayTrace .rays .add (new DebugRayTrace .Ray (
157+ new Vec3 (startPos .x , startPos .y , startPos .z ),
158+ new Vec3 (startPos .x + ray .x * distance , startPos .y + ray .y * distance , startPos .z + ray .z * distance ),
159+ color
160+ ));
161+ }
158162 }
159163 switch (hitResult .getDirection ()) {
160164 case UP , DOWN -> ray .mul (1 , -1 , 1 );
0 commit comments