Advertisement
Corosus

Untitled

Oct 12th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.63 KB | None | 0 0
  1. package net.weather;
  2.  
  3. import java.util.EnumSet;
  4.  
  5. import net.minecraft.client.Minecraft;
  6. import net.minecraft.src.ContainerPlayer;
  7. import net.minecraft.src.EntityPlayer;
  8. import net.minecraft.src.GuiScreen;
  9. import net.minecraft.src.InventoryPlayer;
  10. import net.minecraft.src.ItemStack;
  11. import net.minecraft.src.ServerCommandManager;
  12. import net.minecraft.src.Slot;
  13. import net.minecraft.src.World;
  14. import net.weather.storm.StormManager;
  15. import net.weather.waves.CommandWaveHeight;
  16.  
  17. import cpw.mods.fml.client.FMLClientHandler;
  18. import cpw.mods.fml.common.FMLCommonHandler;
  19. import cpw.mods.fml.common.ITickHandler;
  20. import cpw.mods.fml.common.Side;
  21. import cpw.mods.fml.common.TickType;
  22. import cpw.mods.fml.common.registry.EntityRegistry;
  23.  
  24. public class ServerTickHandler implements ITickHandler
  25. {
  26.     public static WeatherManager sWMan = new WeatherManager();
  27.     public static StormManager sSMan = new StormManager();
  28.  
  29.     @Override
  30.     public void tickStart(EnumSet<TickType> type, Object... tickData)
  31.     {
  32.     }
  33.  
  34.     @Override
  35.     public void tickEnd(EnumSet<TickType> type, Object... tickData)
  36.     {
  37.         if (type.equals(EnumSet.of(TickType.SERVER)))
  38.         {
  39.             onTickInGame();
  40.         }
  41.     }
  42.  
  43.     @Override
  44.     public EnumSet<TickType> ticks()
  45.     {
  46.         return EnumSet.of(TickType.SERVER);
  47.     }
  48.  
  49.     @Override
  50.     public String getLabel()
  51.     {
  52.         return null;
  53.     }
  54.    
  55.     public static boolean addCommands = true;
  56.  
  57.     public void onTickInGame()
  58.     {
  59.        
  60.         if (FMLCommonHandler.instance() == null || FMLCommonHandler.instance().getMinecraftServerInstance() == null)
  61.         {
  62.             return;
  63.         }
  64.  
  65.         World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(0);
  66.        
  67.        
  68.         if (addCommands && world != null) {
  69.             ((ServerCommandManager)FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager()).registerCommand(new CommandWaveHeight());
  70.             addCommands = false;
  71.         } else if (world == null) addCommands = true;
  72.  
  73.         if (world != null)
  74.         {
  75.             WeatherMod.weather(Side.SERVER, world);
  76.             sWMan.tick(Side.SERVER, world);
  77.             sSMan.tick(Side.SERVER);
  78.         }
  79.  
  80.         world = null;//FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(127);
  81.  
  82.         if (world != null)
  83.         {
  84.             WeatherMod.weather(Side.SERVER, world);
  85.             sWMan.tick(Side.SERVER, world);
  86.             sSMan.tick(Side.SERVER);
  87.         }
  88.  
  89.         //System.out.println("onTickInGame");
  90.         //TODO: Your Code Here
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement