File tree Expand file tree Collapse file tree
src/main/java/me/cortex/voxy/client/core/rendering/hierachical Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -648,8 +648,12 @@ public void submitRemoveBatch(MemoryBuffer batch) {//Only called from render thr
648648 public void addTopLevel (long section ) {//Only called from render thread
649649 if (!this .running ) throw new IllegalStateException ("Not running" );
650650 long stamp = this .tlnLock .writeLock ();
651- int state = this .tlnAdd .add (section )?1 :0 ;
652- state -= this .tlnRem .remove (section )?1 :0 ;
651+ int state = 0 ;
652+ if (!this .tlnRem .remove (section )) {
653+ state += this .tlnAdd .add (section )?1 :0 ;
654+ } else {
655+ state -= 1 ;
656+ }
653657 if (state != 0 ) {
654658 if (this .workCounter .getAndAdd (state ) == 0 ) {
655659 LockSupport .unpark (this .thread );
@@ -661,8 +665,12 @@ public void addTopLevel(long section) {//Only called from render thread
661665 public void removeTopLevel (long section ) {//Only called from render thread
662666 if (!this .running ) throw new IllegalStateException ("Not running" );
663667 long stamp = this .tlnLock .writeLock ();
664- int state = this .tlnRem .add (section )?1 :0 ;
665- state -= this .tlnAdd .remove (section )?1 :0 ;
668+ int state = 0 ;
669+ if (!this .tlnAdd .remove (section )) {
670+ state += this .tlnRem .add (section )?1 :0 ;
671+ } else {
672+ state -= 1 ;
673+ }
666674 if (state != 0 ) {
667675 if (this .workCounter .getAndAdd (state ) == 0 ) {
668676 LockSupport .unpark (this .thread );
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ public void insertTopLevelNode(long pos) {
162162
163163 public void removeTopLevelNode (long pos ) {
164164 if (!this .topLevelNodes .remove (pos )) {
165- throw new IllegalStateException ("Position not in top level map" );
165+ throw new IllegalStateException ("Position not in top level map: " + WorldEngine . pprintPos ( pos ) );
166166 }
167167 int nodeId = this .activeSectionMap .get (pos );
168168 if (nodeId == -1 ) {
You can’t perform that action at this time.
0 commit comments