Search in sources :

Example 1 with TickHandlerServer

use of micdoodle8.mods.galacticraft.core.tick.TickHandlerServer in project Galacticraft by micdoodle8.

the class GalacticraftCore method postInit.

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
    GalacticraftCore.planetMercury = makeDummyPlanet("mercury", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetMercury != null) {
        GalacticraftCore.planetMercury.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(1.45F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(0.5F, 0.5F)).setRelativeOrbitTime(0.24096385542168674698795180722892F);
    }
    GalacticraftCore.planetVenus = makeDummyPlanet("venus", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetVenus != null) {
        GalacticraftCore.planetVenus.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(2.0F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(0.75F, 0.75F)).setRelativeOrbitTime(0.61527929901423877327491785323111F);
    }
    GalacticraftCore.planetMars = makeDummyPlanet("mars", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetMars != null) {
        GalacticraftCore.planetMars.setRingColorRGB(0.67F, 0.1F, 0.1F).setPhaseShift(0.1667F).setRelativeSize(0.5319F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(1.25F, 1.25F)).setRelativeOrbitTime(1.8811610076670317634173055859803F);
    }
    GalacticraftCore.planetJupiter = makeDummyPlanet("jupiter", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetJupiter != null) {
        GalacticraftCore.planetJupiter.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift((float) Math.PI).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(1.5F, 1.5F)).setRelativeOrbitTime(11.861993428258488499452354874042F);
    }
    GalacticraftCore.planetSaturn = makeDummyPlanet("saturn", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetSaturn != null) {
        GalacticraftCore.planetSaturn.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(5.45F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(1.75F, 1.75F)).setRelativeOrbitTime(29.463307776560788608981380065717F);
    }
    GalacticraftCore.planetUranus = makeDummyPlanet("uranus", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetUranus != null) {
        GalacticraftCore.planetUranus.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(1.38F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(2.0F, 2.0F)).setRelativeOrbitTime(84.063526834611171960569550930997F);
    }
    GalacticraftCore.planetNeptune = makeDummyPlanet("neptune", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetNeptune != null) {
        GalacticraftCore.planetNeptune.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(1.0F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(2.25F, 2.25F)).setRelativeOrbitTime(164.84118291347207009857612267251F);
    }
    MinecraftForge.EVENT_BUS.register(new OreGenOtherMods());
    GalacticraftCore.proxy.postInit(event);
    ArrayList<CelestialBody> cBodyList = new ArrayList<CelestialBody>();
    cBodyList.addAll(GalaxyRegistry.getRegisteredPlanets().values());
    cBodyList.addAll(GalaxyRegistry.getRegisteredMoons().values());
    for (CelestialBody body : cBodyList) {
        if (body.shouldAutoRegister()) {
            int id = Arrays.binarySearch(ConfigManagerCore.staticLoadDimensions, body.getDimensionID());
            // It's important this is done in the same order as planets will be registered by WorldUtil.registerPlanet();
            if (GalacticraftRegistry.registerProvider(body.getDimensionID(), body.getWorldProvider(), body.getForceStaticLoad() || id < 0, 0)) {
                body.initialiseMobSpawns();
            } else {
                body.setUnreachable();
            }
        }
        if (body.getSurfaceBlocks() != null) {
            TransformerHooks.spawnListAE2_GC.addAll(body.getSurfaceBlocks());
        }
    }
    CompatibilityManager.checkForCompatibleMods();
    RecipeManagerGC.loadRecipes();
    TileEntityDeconstructor.initialiseRecipeList();
    ItemSchematic.registerSchematicItems();
    NetworkRegistry.INSTANCE.registerGuiHandler(GalacticraftCore.instance, new GuiHandler());
    MinecraftForge.EVENT_BUS.register(new TickHandlerServer());
    GalaxyRegistry.refreshGalaxies();
    // Screen API demo
    GalacticraftRegistry.registerScreen(new GameScreenText());
    try {
        jpgWriter = ImageIO.getImageWritersByFormatName("jpg").next();
        writeParam = jpgWriter.getDefaultWriteParam();
        writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
        writeParam.setCompressionQuality(1.0f);
        enableJPEG = true;
    } catch (UnsatisfiedLinkError e) {
        GCLog.severe("Error initialising JPEG compressor - this is likely caused by OpenJDK - see https://wiki.micdoodle8.com/wiki/Compatibility#For_clients_running_OpenJDK");
        e.printStackTrace();
    }
}
Also used : ArrayList(java.util.ArrayList) GuiHandler(micdoodle8.mods.galacticraft.core.client.gui.GuiHandler) GameScreenText(micdoodle8.mods.galacticraft.core.client.screen.GameScreenText) OreGenOtherMods(micdoodle8.mods.galacticraft.core.world.gen.OreGenOtherMods) TickHandlerServer(micdoodle8.mods.galacticraft.core.tick.TickHandlerServer) EventHandler(net.minecraftforge.fml.common.Mod.EventHandler)

Aggregations

ArrayList (java.util.ArrayList)1 GuiHandler (micdoodle8.mods.galacticraft.core.client.gui.GuiHandler)1 GameScreenText (micdoodle8.mods.galacticraft.core.client.screen.GameScreenText)1 TickHandlerServer (micdoodle8.mods.galacticraft.core.tick.TickHandlerServer)1 OreGenOtherMods (micdoodle8.mods.galacticraft.core.world.gen.OreGenOtherMods)1 EventHandler (net.minecraftforge.fml.common.Mod.EventHandler)1