-
Notifications
You must be signed in to change notification settings - Fork 152
Expand file tree
/
Copy pathWorldENet.java
More file actions
executable file
·39 lines (32 loc) · 1.25 KB
/
WorldENet.java
File metadata and controls
executable file
·39 lines (32 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package gregtech.common.pipelike.cable.net;
import gregtech.api.pipenet.WorldPipeNet;
import gregtech.common.pipelike.cable.WireProperties;
import net.minecraft.world.World;
public class WorldENet extends WorldPipeNet<WireProperties, EnergyNet> {
private static final String DATA_ID_BASE = "gregtech.e_net";
public static WorldENet getWorldENet(World world) {
final String DATA_ID = getDataID(DATA_ID_BASE, world);
// First look for saved data
WorldENet eNetWorldData = (WorldENet) world.loadData(WorldENet.class, DATA_ID);
// No saved data, create it and queue it to be saved
if (eNetWorldData == null) {
eNetWorldData = new WorldENet(DATA_ID);
world.setData(DATA_ID, eNetWorldData);
}
// See if we have old data
if (!eNetWorldData.checkedForOldData) {
eNetWorldData.oldData = (WorldENet) world.loadData(WorldENet.class, DATA_ID_BASE);
eNetWorldData.checkedForOldData = true;
}
// Initialise
eNetWorldData.setWorldAndInit(world);
return eNetWorldData;
}
public WorldENet(String name) {
super(name);
}
@Override
protected EnergyNet createNetInstance() {
return new EnergyNet(this);
}
}