Check null for chunk unload #13
This commit is contained in:
@@ -9,6 +9,8 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import net.minecraft.server.Chunk;
|
||||||
import net.minecraft.server.WorldServer;
|
import net.minecraft.server.WorldServer;
|
||||||
|
|
||||||
@Mixin(value = CraftWorld.class, remap = false)
|
@Mixin(value = CraftWorld.class, remap = false)
|
||||||
@@ -30,7 +32,8 @@ public abstract class MixinCraftWorld {
|
|||||||
opcode = Opcodes.INVOKEINTERFACE
|
opcode = Opcodes.INVOKEINTERFACE
|
||||||
))
|
))
|
||||||
public boolean regenChunk(Set<Long> set, Object chunkHash) {
|
public boolean regenChunk(Set<Long> set, Object chunkHash) {
|
||||||
world.getChunkProviderServer().chunks.get(chunkHash).setShouldUnload(false);
|
Chunk chunk = world.getChunkProviderServer().chunks.get(chunkHash);
|
||||||
|
if (chunk != null) chunk.setShouldUnload(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user