Advertisement
Guest User

Untitled

a guest
Sep 10th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. package com.degoos.wetsponge.mixin;
  2.  
  3. import com.degoos.wetsponge.util.InternalLogger;
  4. import com.degoos.wetsponge.world.WSChunkProviderServerSavable;
  5. import net.minecraft.world.WorldServer;
  6. import net.minecraft.world.chunk.Chunk;
  7. import net.minecraft.world.chunk.storage.IChunkLoader;
  8. import net.minecraft.world.gen.ChunkProviderServer;
  9. import org.spongepowered.asm.mixin.Final;
  10. import org.spongepowered.asm.mixin.Mixin;
  11. import org.spongepowered.asm.mixin.Overwrite;
  12. import org.spongepowered.asm.mixin.Shadow;
  13.  
  14. @Mixin(ChunkProviderServer.class)
  15. public abstract class MixinChunkProviderServer implements WSChunkProviderServerSavable {
  16.  
  17.     private boolean saveChunks = true;
  18.  
  19.     @Shadow
  20.     @Final
  21.     private WorldServer  worldObj;
  22.     @Shadow
  23.     @Final
  24.     private IChunkLoader chunkLoader;
  25.  
  26.  
  27.     /**
  28.      * @author WetSponge
  29.      * @reason SaveChunks
  30.      */
  31.     @Overwrite
  32.     private void saveChunkExtraData(Chunk chunkIn) {
  33.         System.out.println(chunkLoader + ", " + worldObj);
  34.         if (saveChunks) {
  35.             try {
  36.                 chunkLoader.saveExtraChunkData(worldObj, chunkIn);
  37.             } catch (Exception var3) {
  38.                 InternalLogger.sendError("Minecraft -> Couldn't save entities");
  39.                 var3.printStackTrace();
  40.             }
  41.         }
  42.     }
  43.  
  44.     public boolean canSaveChunks() {
  45.         return saveChunks;
  46.     }
  47.  
  48.     public void setSaveChunks(boolean saveChunks) {
  49.         this.saveChunks = saveChunks;
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement