OSDN Git Service

いろいろした
[chemicraft/chemicraft.git] / common / pcc / addon / crops / WorldEventHandler.java
1 package pcc.addon.crops;
2
3 import java.io.IOException;
4
5 import net.minecraftforge.event.ForgeSubscribe;
6 import net.minecraftforge.event.world.WorldEvent.Load;
7 import net.minecraftforge.event.world.WorldEvent.Save;
8
9 public class WorldEventHandler {
10
11         @ForgeSubscribe
12         public void event(Load event) {
13                 try {
14                         ChemicalCrops.dataStream.createDataInputStream();
15                         ChemicalCrops.dataStream.createDataOutputStream();
16                         ChemicalCrops.dataStream.read();
17                         ChemicalCrops.instance.startAutoSave();
18                 } catch (IOException e) {
19                         e.printStackTrace();
20                 }
21         }
22
23         @ForgeSubscribe
24         public void event(Save event) {
25                 try {
26                         ChemicalCrops.instance.stopAutoSave();
27                         ChemicalCrops.dataStream.write();
28                         ChemicalCrops.dataStream.clearPlantDataHash();
29                 } catch (IOException e) {
30                         e.printStackTrace();
31                 }
32         }
33
34 }