@@ -46,7 +46,7 @@ public static ChunkHolder newInstance() {
4646 private volatile IChunkGet chunkExisting ; // The existing chunk (e.g. a clipboard, or the world, before changes)
4747 private volatile IChunkSet chunkSet ; // The blocks to be set to the chunkExisting
4848 private IBlockDelegate delegate ; // delegate handles the abstraction of the chunk layers
49- private IQueueExtent <? extends IChunk > extent ; // the parent queue extent which has this chunk
49+ private IQueueExtent <?> extent ; // the parent queue extent which has this chunk
5050 private int chunkX ;
5151 private int chunkZ ;
5252 private boolean fastmode ;
@@ -55,7 +55,7 @@ public static ChunkHolder newInstance() {
5555 private boolean createCopy = false ;
5656 private long initTime = -1L ;
5757 private SideEffectSet sideEffectSet ;
58- private WrapperChunk <? extends IChunk > parentWrapper = null ;
58+ private WrapperChunk <?> parentWrapper = null ;
5959
6060 private ChunkHolder () {
6161 this .delegate = NULL ;
@@ -66,7 +66,7 @@ public void init(IBlockDelegate delegate) {
6666 }
6767
6868 @ Override
69- public void setWrapper (WrapperChunk <? extends IChunk > parentWrapper ) {
69+ public void setWrapper (WrapperChunk <?> parentWrapper ) {
7070 if (parentWrapper == this .parentWrapper ) {
7171 return ;
7272 }
@@ -79,7 +79,9 @@ public void setWrapper(WrapperChunk<? extends IChunk> parentWrapper) {
7979 @ Override
8080 public void invalidateWrapper () {
8181 if (this .parentWrapper != null ) {
82- this .parentWrapper .invalidate (this );
82+ if (!this .parentWrapper .invalidate (this )) {
83+ throw new IllegalStateException ("Existing chunk not equal to expected" );
84+ }
8385 }
8486 }
8587
@@ -917,6 +919,8 @@ public synchronized void filterBlocks(Filter filter, ChunkFilterBlock block, @Nu
917919 final IChunkSet set = getOrCreateSet ();
918920 if (parentWrapper == null ) {
919921 parentWrapper = new WrapperChunk <>(this , () -> this .extent .getOrCreateChunk (getX (), getZ ()));
922+ } else if (parentWrapper .get () != this ) {
923+ throw new IllegalStateException ("Parent WrapperChunk is not storing this chunk!?" );
920924 }
921925 try {
922926 block .filter (parentWrapper , get , set , filter , region , full );
@@ -1025,9 +1029,8 @@ public synchronized <V extends IChunk> void init(IQueueExtent<V> extent, int chu
10251029 this .chunkX = chunkX ;
10261030 this .chunkZ = chunkZ ;
10271031 if (this .parentWrapper != null ) {
1028- try {
1029- this .parentWrapper .invalidate (this );
1030- } catch (IllegalStateException ignored ) {
1032+ if (!this .parentWrapper .invalidate (this )) {
1033+ throw new IllegalStateException ("Existing chunk not equal to expected" );
10311034 }
10321035 this .parentWrapper = null ;
10331036 }
@@ -1060,14 +1063,11 @@ public synchronized T call() {
10601063 */
10611064
10621065 @ Override
1063- public <U extends Future <U >> U call (IQueueExtent <? extends IChunk > owner , IChunkSet set , Runnable finalize ) {
1066+ public <U extends Future <U >> U call (IQueueExtent <?> owner , IChunkSet set , Runnable finalize ) {
10641067 if (set != null ) {
10651068 if (parentWrapper != null ) {
1066- try {
1067- parentWrapper .invalidate (this );
1068- } catch (Exception e ) {
1069- LOGGER .error (this .initTime + " : " + ((ChunkHolder ) parentWrapper .get ()).initTime );
1070- throw e ;
1069+ if (!parentWrapper .invalidate (this )) {
1070+ throw new IllegalStateException ("Existing chunk not equal to expected" );
10711071 }
10721072 }
10731073 IChunkGet get = getOrCreateGet ();
@@ -1111,7 +1111,7 @@ private void untrackExtent() {
11111111 /**
11121112 * Get the extent this chunk is in.
11131113 */
1114- public IQueueExtent <? extends IChunk > getExtent () {
1114+ public IQueueExtent <?> getExtent () {
11151115 return extent ;
11161116 }
11171117
0 commit comments