-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathStellarTickHandler.java
More file actions
46 lines (39 loc) · 1.42 KB
/
StellarTickHandler.java
File metadata and controls
46 lines (39 loc) · 1.42 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
40
41
42
43
44
45
46
package stellarium;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.relauncher.Side;
import stellarium.stellars.StellarManager;
import stellarium.world.StellarScene;
public class StellarTickHandler {
@SubscribeEvent
public void tickStart(TickEvent.ClientTickEvent e) {
if(e.phase == TickEvent.Phase.START) {
StellarSky.PROXY.updateTick();
}
}
@SubscribeEvent
public void tickStart(TickEvent.ServerTickEvent e) {
if(e.phase == TickEvent.Phase.START) {
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
World world = server.getEntityWorld();
if(world != null) {
StellarManager manager = StellarManager.getManager(world);
if(manager.getCelestialManager() != null)
manager.update(world.getWorldTime());
}
}
}
@SubscribeEvent
public void tickStart(TickEvent.WorldTickEvent e) {
if(e.phase == TickEvent.Phase.START && e.side == Side.SERVER){
MinecraftServer server = e.world.getMinecraftServer();
World defWorld = server.getEntityWorld();
StellarScene dimManager = StellarScene.getScene(e.world);
if(dimManager != null)
dimManager.update(e.world, e.world.getWorldTime(), defWorld.getTotalWorldTime());
}
}
}