Search in sources :

Example 6 with Planet

use of micdoodle8.mods.galacticraft.api.galaxies.Planet in project Galacticraft by micdoodle8.

the class GalacticraftCore method init.

@EventHandler
public void init(FMLInitializationEvent event) {
    GCBlocks.doOtherModsTorches();
    GalacticraftCore.handler.registerItemChanges();
    GalacticraftCore.galacticraftBlocksTab.setItemForTab(Item.getItemFromBlock(GCBlocks.machineBase2));
    GalacticraftCore.galacticraftItemsTab.setItemForTab(GCItems.rocketTier1);
    if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
        GCBlocks.finalizeSort();
        GCItems.finalizeSort();
    }
    GalacticraftCore.proxy.init(event);
    GalacticraftCore.packetPipeline = GalacticraftChannelHandler.init();
    GalacticraftCore.solarSystemSol = new SolarSystem("sol", "milky_way").setMapPosition(new Vector3(0.0F, 0.0F, 0.0F));
    Star starSol = (Star) new Star("sol").setParentSolarSystem(GalacticraftCore.solarSystemSol).setTierRequired(-1);
    starSol.setBodyIcon(new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/celestialbodies/sun.png"));
    GalacticraftCore.solarSystemSol.setMainStar(starSol);
    GalacticraftCore.planetOverworld = (Planet) new Planet("overworld").setParentSolarSystem(GalacticraftCore.solarSystemSol).setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(0.0F);
    GalacticraftCore.planetOverworld.setBodyIcon(new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/celestialbodies/earth.png"));
    GalacticraftCore.planetOverworld.setDimensionInfo(ConfigManagerCore.idDimensionOverworld, WorldProvider.class, false).setTierRequired(1);
    GalacticraftCore.planetOverworld.atmosphereComponent(EnumAtmosphericGas.NITROGEN).atmosphereComponent(EnumAtmosphericGas.OXYGEN).atmosphereComponent(EnumAtmosphericGas.ARGON).atmosphereComponent(EnumAtmosphericGas.WATER);
    GalacticraftCore.planetOverworld.addChecklistKeys("equip_parachute");
    GalacticraftCore.moonMoon = (Moon) new Moon("moon").setParentPlanet(GalacticraftCore.planetOverworld).setRelativeSize(0.2667F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(13F, 13F)).setRelativeOrbitTime(1 / 0.01F);
    GalacticraftCore.moonMoon.setDimensionInfo(ConfigManagerCore.idDimensionMoon, WorldProviderMoon.class).setTierRequired(1);
    GalacticraftCore.moonMoon.setBodyIcon(new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/celestialbodies/moon.png"));
    GalacticraftCore.moonMoon.setAtmosphere(new AtmosphereInfo(false, false, false, 0.0F, 0.0F, 0.0F));
    GalacticraftCore.moonMoon.setBiomeInfo(BiomeGenBaseMoon.moonFlat);
    GalacticraftCore.moonMoon.addMobInfo(new SpawnListEntry(EntityEvolvedZombie.class, 8, 2, 3));
    GalacticraftCore.moonMoon.addMobInfo(new SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3));
    GalacticraftCore.moonMoon.addMobInfo(new SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3));
    GalacticraftCore.moonMoon.addMobInfo(new SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3));
    GalacticraftCore.moonMoon.addMobInfo(new SpawnListEntry(EntityEvolvedEnderman.class, 10, 1, 4));
    GalacticraftCore.moonMoon.addChecklistKeys("equip_oxygen_suit");
    // Satellites must always have a WorldProvider implementing IOrbitDimension
    GalacticraftCore.satelliteSpaceStation = (Satellite) new Satellite("spacestation.overworld").setParentBody(GalacticraftCore.planetOverworld).setRelativeSize(0.2667F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(9F, 9F)).setRelativeOrbitTime(1 / 0.05F);
    GalacticraftCore.satelliteSpaceStation.setDimensionInfo(ConfigManagerCore.idDimensionOverworldOrbit, ConfigManagerCore.idDimensionOverworldOrbitStatic, WorldProviderOverworldOrbit.class).setTierRequired(1);
    GalacticraftCore.satelliteSpaceStation.setBodyIcon(new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/celestialbodies/space_station.png"));
    GalacticraftCore.satelliteSpaceStation.setAtmosphere(new AtmosphereInfo(false, false, false, 0.0F, 0.1F, 0.02F));
    GalacticraftCore.satelliteSpaceStation.addChecklistKeys("equip_oxygen_suit", "create_grapple");
    ForgeChunkManager.setForcedChunkLoadingCallback(GalacticraftCore.instance, new ChunkLoadingCallback());
    MinecraftForge.EVENT_BUS.register(new ConnectionEvents());
    SchematicRegistry.registerSchematicRecipe(new SchematicRocketT1());
    SchematicRegistry.registerSchematicRecipe(new SchematicMoonBuggy());
    SchematicRegistry.registerSchematicRecipe(new SchematicAdd());
    ChunkPowerHandler.initiate();
    EnergyConfigHandler.initGas();
    CompatibilityManager.registerMicroBlocks();
    this.registerCreatures();
    this.registerOtherEntities();
    this.registerTileEntities();
    GalaxyRegistry.registerSolarSystem(GalacticraftCore.solarSystemSol);
    GalaxyRegistry.registerPlanet(GalacticraftCore.planetOverworld);
    GalaxyRegistry.registerMoon(GalacticraftCore.moonMoon);
    GalaxyRegistry.registerSatellite(GalacticraftCore.satelliteSpaceStation);
    GalacticraftRegistry.registerProvider(ConfigManagerCore.idDimensionOverworldOrbit, WorldProviderOverworldOrbit.class, false, 0);
    GalacticraftRegistry.registerProvider(ConfigManagerCore.idDimensionOverworldOrbitStatic, WorldProviderOverworldOrbit.class, true, 0);
    GalacticraftRegistry.registerTeleportType(WorldProviderSurface.class, new TeleportTypeOverworld());
    GalacticraftRegistry.registerTeleportType(WorldProviderOverworldOrbit.class, new TeleportTypeOrbit());
    GalacticraftRegistry.registerTeleportType(WorldProviderMoon.class, new TeleportTypeMoon());
    GalacticraftRegistry.registerRocketGui(WorldProviderOverworldOrbit.class, new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/overworld_rocket_gui.png"));
    GalacticraftRegistry.registerRocketGui(WorldProviderSurface.class, new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/overworld_rocket_gui.png"));
    GalacticraftRegistry.registerRocketGui(WorldProviderMoon.class, new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/moon_rocket_gui.png"));
    GalacticraftRegistry.addDungeonLoot(1, new ItemStack(GCItems.schematic, 1, 0));
    GalacticraftRegistry.addDungeonLoot(1, new ItemStack(GCItems.schematic, 1, 1));
    if (ConfigManagerCore.enableCopperOreGen) {
        GameRegistry.registerWorldGenerator(new OverworldGenerator(GCBlocks.basicBlock, 5, 24, 0, 75, 7), 4);
    }
    if (ConfigManagerCore.enableTinOreGen) {
        GameRegistry.registerWorldGenerator(new OverworldGenerator(GCBlocks.basicBlock, 6, 22, 0, 60, 7), 4);
    }
    if (ConfigManagerCore.enableAluminumOreGen) {
        GameRegistry.registerWorldGenerator(new OverworldGenerator(GCBlocks.basicBlock, 7, 18, 0, 45, 7), 4);
    }
    if (ConfigManagerCore.enableSiliconOreGen) {
        GameRegistry.registerWorldGenerator(new OverworldGenerator(GCBlocks.basicBlock, 8, 3, 0, 25, 7), 4);
    }
    FMLInterModComms.sendMessage("OpenBlocks", "donateUrl", "http://www.patreon.com/micdoodle8");
    registerCoreGameScreens();
    GCFluids.registerLegacyFluids();
    GCFluids.registerDispenserBehaviours();
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_MASK, EnumExtendedInventorySlot.MASK, GCItems.oxMask);
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_GEAR, EnumExtendedInventorySlot.GEAR, GCItems.oxygenGear);
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_LIGHT, EnumExtendedInventorySlot.LEFT_TANK, GCItems.oxTankLight);
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_LIGHT, EnumExtendedInventorySlot.RIGHT_TANK, GCItems.oxTankLight);
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_MEDIUM, EnumExtendedInventorySlot.LEFT_TANK, GCItems.oxTankMedium);
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_MEDIUM, EnumExtendedInventorySlot.RIGHT_TANK, GCItems.oxTankMedium);
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_HEAVY, EnumExtendedInventorySlot.LEFT_TANK, GCItems.oxTankHeavy);
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_HEAVY, EnumExtendedInventorySlot.RIGHT_TANK, GCItems.oxTankHeavy);
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_INFINITE, EnumExtendedInventorySlot.LEFT_TANK, GCItems.oxygenCanisterInfinite);
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_OXYGEN_TANK_INFINITE, EnumExtendedInventorySlot.RIGHT_TANK, GCItems.oxygenCanisterInfinite);
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_PARACHUTE, EnumExtendedInventorySlot.PARACHUTE, GCItems.parachute);
    GalacticraftRegistry.registerGear(Constants.GEAR_ID_FREQUENCY_MODULE, EnumExtendedInventorySlot.FREQUENCY_MODULE, new ItemStack(GCItems.basicItem, 1, 19));
    GalacticraftCore.proxy.registerFluidTexture(GCFluids.fluidOil, new ResourceLocation(Constants.ASSET_PREFIX, "textures/misc/underoil.png"));
    GalacticraftCore.proxy.registerFluidTexture(GCFluids.fluidFuel, new ResourceLocation(Constants.ASSET_PREFIX, "textures/misc/underfuel.png"));
// switch (this.getSlotIndex())
// {
// case 0:
// return itemstack.getItem() instanceof ItemOxygenMask;
// case 1:
// return itemstack.getItem() == GCItems.oxygenGear;
// case 2:
// case 3:
// return itemstack.getItem() instanceof ItemOxygenTank || itemstack.getItem() instanceof ItemCanisterOxygenInfinite;
// case 4:
// return itemstack.getItem() instanceof ItemParaChute;
// case 5:
// return itemstack.getItem() == GCItems.basicItem && itemstack.getItemDamage() == 19;
// case 6:
// return this.thermalArmorSlotValid(itemstack, 0);
// case 7:
// return this.thermalArmorSlotValid(itemstack, 1);
// case 8:
// return this.thermalArmorSlotValid(itemstack, 2);
// case 9:
// return this.thermalArmorSlotValid(itemstack, 3);
// case 10:
// return this.shieldControllerSlotValid(itemstack);
// }
}
Also used : BiomeGenBaseMoon(micdoodle8.mods.galacticraft.core.world.gen.BiomeGenBaseMoon) SchematicMoonBuggy(micdoodle8.mods.galacticraft.core.schematic.SchematicMoonBuggy) ChunkLoadingCallback(micdoodle8.mods.galacticraft.core.world.ChunkLoadingCallback) ResourceLocation(net.minecraft.util.ResourceLocation) SchematicAdd(micdoodle8.mods.galacticraft.core.schematic.SchematicAdd) WorldProvider(net.minecraft.world.WorldProvider) SchematicRocketT1(micdoodle8.mods.galacticraft.core.schematic.SchematicRocketT1) OverworldGenerator(micdoodle8.mods.galacticraft.core.world.gen.OverworldGenerator) AtmosphereInfo(micdoodle8.mods.galacticraft.api.world.AtmosphereInfo) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) SpawnListEntry(net.minecraft.world.biome.BiomeGenBase.SpawnListEntry) ConnectionEvents(micdoodle8.mods.galacticraft.core.network.ConnectionEvents) ItemStack(net.minecraft.item.ItemStack) EventHandler(net.minecraftforge.fml.common.Mod.EventHandler)

Example 7 with Planet

use of micdoodle8.mods.galacticraft.api.galaxies.Planet in project Galacticraft by micdoodle8.

the class EventHandlerGC method overrideSkyColor.

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void overrideSkyColor(FogColors event) {
    // Disable any night vision effects on the sky, if the planet has no atmosphere
    if (event.entity instanceof EntityLivingBase && ((EntityLivingBase) event.entity).isPotionActive(Potion.nightVision)) {
        WorldClient worldclient = Minecraft.getMinecraft().theWorld;
        if (worldclient.provider instanceof IGalacticraftWorldProvider && ((IGalacticraftWorldProvider) worldclient.provider).hasNoAtmosphere() && event.block.getMaterial() == Material.air && !((IGalacticraftWorldProvider) worldclient.provider).hasBreathableAtmosphere()) {
            Vec3 vec = worldclient.getFogColor(1.0F);
            event.red = (float) vec.xCoord;
            event.green = (float) vec.yCoord;
            event.blue = (float) vec.zCoord;
            return;
        }
        if (worldclient.provider.getSkyRenderer() instanceof SkyProviderOverworld && event.entity.posY > Constants.OVERWORLD_SKYPROVIDER_STARTHEIGHT) {
            Vec3 vec = TransformerHooks.getFogColorHook(event.entity.worldObj);
            event.red = (float) vec.xCoord;
            event.green = (float) vec.yCoord;
            event.blue = (float) vec.zCoord;
            return;
        }
    }
}
Also used : IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3) EntityLivingBase(net.minecraft.entity.EntityLivingBase) SkyProviderOverworld(micdoodle8.mods.galacticraft.core.client.SkyProviderOverworld) WorldClient(net.minecraft.client.multiplayer.WorldClient) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 8 with Planet

use of micdoodle8.mods.galacticraft.api.galaxies.Planet in project Galacticraft by micdoodle8.

the class StatsCapability method loadNBTData.

@Override
public void loadNBTData(NBTTagCompound nbt) {
    try {
        this.airRemaining = nbt.getInteger("playerAirRemaining");
        this.damageCounter = nbt.getInteger("damageCounter");
        this.oxygenSetupValid = this.lastOxygenSetupValid = nbt.getBoolean("OxygenSetupValid");
        this.thermalLevel = nbt.getInteger("thermalLevel");
        // Backwards compatibility
        NBTTagList nbttaglist = nbt.getTagList("Inventory", 10);
        this.extendedInventory.readFromNBTOld(nbttaglist);
        if (nbt.hasKey("ExtendedInventoryGC")) {
            this.extendedInventory.readFromNBT(nbt.getTagList("ExtendedInventoryGC", 10));
        }
        // Added for GCInv command - if tried to load an offline player's
        // inventory, load it now
        // (if there was no offline load, then the dontload flag in doLoad()
        // will make sure nothing happens)
        EntityPlayerMP p = this.player.get();
        if (p != null) {
            ItemStack[] saveinv = CommandGCInv.getSaveData(PlayerUtil.getName(p).toLowerCase());
            if (saveinv != null) {
                CommandGCInv.doLoad(p);
            }
        }
        if (nbt.hasKey("SpaceshipTier")) {
            this.spaceshipTier = nbt.getInteger("SpaceshipTier");
        }
        // New keys in version 3.0.5.220
        if (nbt.hasKey("FuelLevel")) {
            this.fuelLevel = nbt.getInteger("FuelLevel");
        }
        if (nbt.hasKey("ReturnRocket")) {
            ItemStack returnRocket = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("ReturnRocket"));
            if (returnRocket != null) {
                this.rocketItem = returnRocket.getItem();
                this.rocketType = returnRocket.getItemDamage();
            }
        }
        this.usingParachute = nbt.getBoolean("usingParachute2");
        this.usingPlanetSelectionGui = nbt.getBoolean("usingPlanetSelectionGui");
        this.teleportCooldown = nbt.getInteger("teleportCooldown");
        this.coordsTeleportedFromX = nbt.getDouble("coordsTeleportedFromX");
        this.coordsTeleportedFromZ = nbt.getDouble("coordsTeleportedFromZ");
        this.startDimension = nbt.hasKey("startDimension") ? nbt.getString("startDimension") : "";
        if (nbt.hasKey("spaceStationDimensionID")) {
            // If loading from an old save file, the home space station is always the overworld, so use 0 as home planet
            this.spaceStationDimensionData = WorldUtil.stringToSpaceStationData("0$" + nbt.getInteger("spaceStationDimensionID"));
        } else {
            this.spaceStationDimensionData = WorldUtil.stringToSpaceStationData(nbt.getString("spaceStationDimensionInfo"));
        }
        if (nbt.getBoolean("usingPlanetSelectionGui")) {
            this.openPlanetSelectionGuiCooldown = 20;
        }
        if (nbt.hasKey("RocketItems") && nbt.hasKey("rocketStacksLength")) {
            final NBTTagList var23 = nbt.getTagList("RocketItems", 10);
            int length = nbt.getInteger("rocketStacksLength");
            this.rocketStacks = new ItemStack[length];
            for (int var3 = 0; var3 < var23.tagCount(); ++var3) {
                final NBTTagCompound var4 = var23.getCompoundTagAt(var3);
                final int var5 = var4.getByte("Slot") & 255;
                if (var5 < this.rocketStacks.length) {
                    this.rocketStacks[var5] = ItemStack.loadItemStackFromNBT(var4);
                }
            }
        }
        this.unlockedSchematics = new ArrayList<ISchematicPage>();
        if (p != null) {
            for (int i = 0; i < nbt.getTagList("Schematics", 10).tagCount(); ++i) {
                final NBTTagCompound nbttagcompound = nbt.getTagList("Schematics", 10).getCompoundTagAt(i);
                final int j = nbttagcompound.getInteger("UnlockedPage");
                SchematicRegistry.addUnlockedPage(p, SchematicRegistry.getMatchingRecipeForID(j));
            }
        }
        Collections.sort(this.unlockedSchematics);
        this.cryogenicChamberCooldown = nbt.getInteger("CryogenicChamberCooldown");
        if (nbt.hasKey("ReceivedSoundWarning")) {
            this.receivedSoundWarning = nbt.getBoolean("ReceivedSoundWarning");
        }
        if (nbt.hasKey("ReceivedBedWarning")) {
            this.receivedBedWarning = nbt.getBoolean("ReceivedBedWarning");
        }
        if (nbt.hasKey("LaunchpadStack")) {
            this.launchpadStack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("LaunchpadStack"));
            if (this.launchpadStack != null && this.launchpadStack.stackSize == 0) {
                this.launchpadStack = null;
            }
        } else {
            // for backwards compatibility with saves which don't have this tag - players can't lose launchpads
            this.launchpadStack = new ItemStack(GCBlocks.landingPad, 9, 0);
        }
        if (nbt.hasKey("BuildFlags")) {
            this.buildFlags = nbt.getInteger("BuildFlags");
        }
        if (nbt.hasKey("ShownSpaceRace")) {
            this.openedSpaceRaceManager = nbt.getBoolean("ShownSpaceRace");
        }
        if (nbt.hasKey("AstroMinerCount")) {
            this.astroMinerCount = nbt.getInteger("AstroMinerCount");
        }
        if (nbt.hasKey("AstroData")) {
            this.activeAstroMinerChunks.clear();
            NBTTagList astroList = nbt.getTagList("AstroData", 10);
            for (int i = 0; i < astroList.tagCount(); ++i) {
                final NBTTagCompound nbttagcompound = astroList.getCompoundTagAt(i);
                BlockVec3 data = BlockVec3.readFromNBT(nbttagcompound);
                this.activeAstroMinerChunks.add(data);
            }
            if (GalacticraftCore.isPlanetsLoaded) {
                AsteroidsTickHandlerServer.loadAstroChunkList(this.activeAstroMinerChunks);
            }
        }
        if (nbt.hasKey("GlassColor1")) {
            this.glassColor1 = nbt.getInteger("GlassColor1");
            this.glassColor2 = nbt.getInteger("GlassColor2");
            this.glassColor3 = nbt.getInteger("GlassColor3");
        }
        if (nbt.hasKey("PanLi")) {
            final NBTTagList panels = nbt.getTagList("PanLi", 10);
            for (int i = 0; i < panels.tagCount(); ++i) {
                if (i == BlockPanelLighting.PANELTYPES_LENGTH)
                    break;
                final NBTTagCompound stateNBT = panels.getCompoundTagAt(i);
                IBlockState bs = TileEntityPanelLight.readBlockState(stateNBT);
                this.panelLightingBases[i] = (bs.getBlock() == Blocks.air) ? null : bs;
            }
        }
        if (nbt.hasKey("PanCo")) {
            this.panelLightingColor = nbt.getInteger("PanCo");
        }
        GCLog.debug("Loading GC player data for " + PlayerUtil.getName(player.get()) + " : " + this.buildFlags);
        this.sentFlags = false;
    } catch (Exception e) {
        GCLog.severe("Found error in saved Galacticraft player data for " + PlayerUtil.getName(player.get()) + " - this should fix itself next relog.");
        e.printStackTrace();
    }
    GCLog.debug("Finished loading GC player data for " + PlayerUtil.getName(player.get()) + " : " + this.buildFlags);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) IBlockState(net.minecraft.block.state.IBlockState) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ItemStack(net.minecraft.item.ItemStack) ISchematicPage(micdoodle8.mods.galacticraft.api.recipe.ISchematicPage) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3)

Example 9 with Planet

use of micdoodle8.mods.galacticraft.api.galaxies.Planet in project Galacticraft by micdoodle8.

the class EntityTieredRocket method initiatePlanetsPreGen.

private void initiatePlanetsPreGen(int cx, int cz) {
    this.preGenList.clear();
    // If the server is at less than 20tps then maybe some of the outermost chunks won't be pre-generated but that's probably OK
    if (this.destinationFrequency == -1 && !EntityTieredRocket.preGenInProgress) {
        ArrayList<Integer> toPreGen = new ArrayList<>();
        for (Planet planet : GalaxyRegistry.getRegisteredPlanets().values()) {
            if (planet.getDimensionID() == this.dimension) {
                continue;
            }
            if (planet.getReachable() && planet.getTierRequirement() <= this.getRocketTier() && !planet.getUnlocalizedName().equals("planet.asteroids")) {
                toPreGen.add(planet.getDimensionID());
            }
        }
        if (toPreGen.size() > 0) {
            for (Integer dimID : toPreGen) {
                this.preGenList.add(new BlockVec3(cx, dimID, cz));
                if (ConfigManagerCore.enableDebug) {
                    GCLog.info("Starting terrain pregen for dimension " + dimID + " at " + (cx * 16 + 8) + ", " + (cz * 16 + 8));
                }
            }
            for (// concentric squares with radius r
            int r = 1; // concentric squares with radius r
            r < 12; // concentric squares with radius r
            r++) {
                int xmin = cx - r;
                int xmax = cx + r;
                int zmin = cz - r;
                int zmax = cz + r;
                for (// stop before i == r to avoid doing corners twice
                int i = -r; // stop before i == r to avoid doing corners twice
                i < r; // stop before i == r to avoid doing corners twice
                i++) {
                    for (Integer dimID : toPreGen) {
                        this.preGenList.add(new BlockVec3(xmin, dimID, cz + i));
                        this.preGenList.add(new BlockVec3(xmax, dimID, cz - i));
                        this.preGenList.add(new BlockVec3(cx - i, dimID, zmin));
                        this.preGenList.add(new BlockVec3(cx + i, dimID, zmax));
                    }
                }
            }
            this.preGenIterator = this.preGenList.iterator();
            EntityTieredRocket.preGenInProgress = true;
        }
    } else {
        this.preGenIterator = null;
    }
}
Also used : ArrayList(java.util.ArrayList) Planet(micdoodle8.mods.galacticraft.api.galaxies.Planet) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3)

Example 10 with Planet

use of micdoodle8.mods.galacticraft.api.galaxies.Planet in project Galacticraft by micdoodle8.

the class GameScreenCelestial method drawCelestialBodies.

private void drawCelestialBodies(CelestialBody body, float ticks) {
    Star star = null;
    SolarSystem solarSystem = null;
    if (body instanceof Planet) {
        solarSystem = ((Planet) body).getParentSolarSystem();
    } else if (body instanceof Moon) {
        solarSystem = ((Moon) body).getParentPlanet().getParentSolarSystem();
    } else if (body instanceof Satellite) {
        solarSystem = ((Satellite) body).getParentPlanet().getParentSolarSystem();
    }
    if (solarSystem == null) {
        solarSystem = GalacticraftCore.solarSystemSol;
    }
    star = solarSystem.getMainStar();
    if (star != null && star.getBodyIcon() != null) {
        this.drawCelestialBody(star, 0F, 0F, ticks, 6F, 1.0);
    }
    String mainSolarSystem = solarSystem.getUnlocalizedName();
    for (Planet planet : GalaxyRegistry.getRegisteredPlanets().values()) {
        if (planet.getParentSolarSystem() != null && planet.getBodyIcon() != null) {
            if (planet.getParentSolarSystem().getUnlocalizedName().equalsIgnoreCase(mainSolarSystem)) {
                Vector3f pos = this.getCelestialBodyPosition(planet, ticks);
                this.drawCircle(planet);
                this.drawCelestialBody(planet, pos.x, pos.y, ticks, (planet.getRelativeDistanceFromCenter().unScaledDistance < 1.5F) ? 2F : 2.8F, 0.75);
            }
        }
    }
}
Also used : Vector3f(org.lwjgl.util.vector.Vector3f) RenderPlanet(micdoodle8.mods.galacticraft.core.client.render.RenderPlanet)

Aggregations

ItemStack (net.minecraft.item.ItemStack)7 ResourceLocation (net.minecraft.util.ResourceLocation)7 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)6 Planet (micdoodle8.mods.galacticraft.api.galaxies.Planet)4 AtmosphereInfo (micdoodle8.mods.galacticraft.api.world.AtmosphereInfo)4 Vector3f (org.lwjgl.util.vector.Vector3f)4 ScalableDistance (micdoodle8.mods.galacticraft.api.galaxies.CelestialBody.ScalableDistance)3 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 CelestialBodyRenderEvent (micdoodle8.mods.galacticraft.api.event.client.CelestialBodyRenderEvent)2 SpaceStationRecipe (micdoodle8.mods.galacticraft.api.recipe.SpaceStationRecipe)2 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)2 Entity (net.minecraft.entity.Entity)2 EntityLivingBase (net.minecraft.entity.EntityLivingBase)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 PotionEffect (net.minecraft.potion.PotionEffect)2 WorldProvider (net.minecraft.world.WorldProvider)2 WorldServer (net.minecraft.world.WorldServer)2 SpawnListEntry (net.minecraft.world.biome.BiomeGenBase.SpawnListEntry)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2