• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Star类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中micdoodle8.mods.galacticraft.api.galaxies.Star的典型用法代码示例。如果您正苦于以下问题:Java Star类的具体用法?Java Star怎么用?Java Star使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

Star类属于micdoodle8.mods.galacticraft.api.galaxies包,在下文中一共展示了Star类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initVars

点赞 3

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
protected void initVars() {

        this.sunSize = 2*worldProvider.getSolarSize();
        if(curBody instanceof Planet) {
            rType = RenderType.PLANET;
            curBodyPlanet = ((Planet)curBody);
            curSystem = ((Planet)curBody).getParentSolarSystem();
        } else if(curBody instanceof Moon) {
            rType = RenderType.MOON;
            curBodyPlanet = ((Moon)curBody).getParentPlanet();
            curSystem = (((Moon)curBody).getParentPlanet()).getParentSolarSystem();
        } else if(curBody instanceof Star){
            rType = RenderType.STAR;
            curSystem = ((Star)curBody).getParentSolarSystem();
            // this skyprovider is only for moons and planets
        }

        checkAsteroidRendering(curBody);

        this.hasAtmosphere = curBody.atmosphere.size() > 0;
        curBodyDistance = curBodyPlanet.getRelativeDistanceFromCenter().unScaledDistance;
    }
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:23,
代码来源:SkyProviderDynamic.java

示例2: getOrbitableBodyName

点赞 3

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
/**
 * Returns a string in the format "solarSystem\planet\moon", for any body which is mothership-orbitable
 * @param body
 * @return
 */
public static String getOrbitableBodyName(CelestialBody body) {

    // now try solarSystem\planet\moon format


    if(body instanceof Star) {
        return getSystemMainStarName(((Star)body).getParentSolarSystem());
    }

    if(body instanceof Planet) {
        return getPlanetName((Planet) body);
    }

    if(body instanceof Moon) {
        return getMoonName((Moon)body);
    }

    throw new RuntimeException("Invalid celestialbody for "+body.getName());
}
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:25,
代码来源:AstronomyHelper.java

示例3: getSolarSystem

点赞 3

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
/**
 * Gets the solar system in which a body is located
 * @param body
 * @return
 */
public static SolarSystem getSolarSystem(CelestialBody body) {
    if(body instanceof Star) {
        return ((Star)body).getParentSolarSystem();
    }
    if(body instanceof Planet) {
        return ((Planet)body).getParentSolarSystem();
    }
    if(body instanceof IChildBody) {
        return ((IChildBody)body).getParentPlanet().getParentSolarSystem();
    }
    if(body instanceof Mothership) {
        return getSolarSystem(((Mothership)body).getDestination());
    }
    return null;
}
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:21,
代码来源:AstronomyHelper.java

示例4: getSolarEnergyMultiplier

点赞 3

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
public static float getSolarEnergyMultiplier(CelestialBody body, boolean hasAtmosphere) {
    if(body instanceof Star) {
        return 2.0F;
    }
    body = getParentPlanet(body);
    //body.atmosphere
    // this is the original formula. I'm not sure if this so good,
    // since for a distance of 0.1 it would give a factor of 1000 (yes, ONE THOUSAND)
    float solarSize = 1.0F/body.getRelativeDistanceFromCenter().unScaledDistance;
    float level = solarSize * solarSize * solarSize;

    if(!hasAtmosphere) {
        level *= ConfigManagerCore.spaceStationEnergyScalar;
    }

    if(level > maxSolarLevel) {
        level = maxSolarLevel;
    }
    return level;
}
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:21,
代码来源:AstronomyHelper.java

示例5: canBeOrbited

点赞 2

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
public static boolean canBeOrbited(CelestialBody body) {
    return (
        (AmunRa.config.mothershipMaxTier >= body.getTierRequirement()) &&
        (body instanceof Planet) || (body instanceof Moon) || (body instanceof Star) &&
        !AmunRa.config.mothershipBodiesNoOrbit.contains(body.getName())
    );
}
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:8,
代码来源:Mothership.java

示例6: isDaytime

点赞 2

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
@Override
public boolean isDaytime()
{
    if(!this.mothershipObj.isInTransit() && (mothershipObj.getParent() instanceof Star)) {
        return true;
    }

    final float a = this.worldObj.getCelestialAngle(0F);
    //TODO: adjust this according to size of planet below. Or don't? I can say, we get closer for smaller planets :D
    return a < 0.42F || a > 0.58F;
}
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:12,
代码来源:MothershipWorldProvider.java

示例7: getCelestialBodyParent

点赞 2

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
/**
 * Gets the immediate parent of a body, except for stars, there it returns the star back
 * @param body
 * @return
 */
public static CelestialBody getCelestialBodyParent(CelestialBody body) {
    if(body instanceof Planet) {
        return ((Planet)body).getParentSolarSystem().getMainStar();
    } else if(body instanceof IChildBody) {
        return ((IChildBody)body).getParentPlanet();
    } else if(body instanceof Mothership) {
        return ((Mothership)body).getParent();
    } else if(body instanceof Star) {
        return body;
    }
    return null;
}
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:18,
代码来源:AstronomyHelper.java

示例8: isStar

点赞 2

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
/**
 * Checks if the body is an actual star or a "fake star"
 * @param body
 * @return
 */
public static boolean isStar(CelestialBody body) {
    if(body instanceof Star || body == AmunRa.instance.starAmun || AmunRa.config.isSun(body)) {
        return true;
    }
    return false;
}
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:12,
代码来源:AstronomyHelper.java

示例9: getThermalLevel

点赞 2

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
/**
 * Should calculate a thermal level depending on that body's distance from the star in it's system
 *
 * @param body
 * @return
 */
public static float getThermalLevel(CelestialBody body) {
    if(body instanceof Star) {
        return maxTemperature;
    }
    body = getParentPlanet(body);
    float dist = body.getRelativeDistanceFromCenter().unScaledDistance;
    // now IRL this is most certainly a form of 1/r²
    // let's see
    // name      | thermal | distance
    // OW        |   0     |    1
    // mars      |  -1     |  1.25F
    // asteroids |  -1.5   |  1.375F
    // that looks linear oO
    // eh, let's just do it linear
    // m = -4
    // t = 4

    float temperature = -4 * dist + 4;
    if(temperature < -maxTemperature) {
        temperature = -maxTemperature;
    } else if(temperature > maxTemperature) {
        temperature = maxTemperature;
    }


    return temperature;
}
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:34,
代码来源:AstronomyHelper.java

示例10: getBodyToRenderMothershipsAround

点赞 2

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
protected CelestialBody getBodyToRenderMothershipsAround() {

        if(this.selectedBody instanceof Star) {
            if(selectionCount != 1 && this.ticksSinceSelection > 35) {
                return this.selectedBody;
            }
            return null;
        }
        if(this.selectedBody instanceof Planet) {
            // ship's parent is the body and selectionCount != 1
            // AND
            // this.ticksSinceSelection > 35
            if(selectionCount != 1 && this.ticksSinceSelection > 35) {
                return this.selectedBody;
            }
            return null;
        } else if(this.selectedBody instanceof IChildBody) {
            if(selectionCount != 1 && this.ticksSinceSelection > 35) {
                return this.selectedBody;
            }
            return null;
            //renderShipsAround = ((IChildBody)this.selectedBody).getParentPlanet();
            // I almost think never TODO find out
        } else if(this.selectedBody instanceof Mothership) {
            return ((Mothership)this.selectedBody).getParent();
        }
        return null;
    }
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:29,
代码来源:GuiARCelestialSelection.java

示例11: getCelestialBodyPosition

点赞 2

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
@Override
protected Vector3f getCelestialBodyPosition(CelestialBody cBody)
{
    if (cBody instanceof Mothership)
    {
        // failsafe against a possible race condition
        int cBodyTicks = 0;
        if(this.celestialBodyTicks.get(cBody) != null) {

            cBodyTicks = this.celestialBodyTicks.get(cBody);
        }
        float timeScale = 2.0F;
        float distanceFromCenter = this.getScale(cBody);
        float orbitTime = 1 / 0.01F;// 5.0F;

        CelestialBody msParent = ((Mothership) cBody).getParent();
        if(msParent instanceof Star) {
            distanceFromCenter *= 3;
        }

        Vector3f cBodyPos = new Vector3f((float) Math.sin(cBodyTicks / (timeScale * orbitTime) + cBody.getPhaseShift()) * distanceFromCenter, (float) Math.cos(cBodyTicks / (timeScale * orbitTime) + cBody.getPhaseShift()) * distanceFromCenter, 0);

        Vector3f parentVec = this.getCelestialBodyPosition(((Mothership) cBody).getParent());
        return Vector3f.add(cBodyPos, parentVec, null);
    }


    return super.getCelestialBodyPosition(cBody);
}
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:30,
代码来源:GuiARCelestialSelection.java

示例12: renderPlanetByAngle

点赞 2

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
protected void renderPlanetByAngle(Tessellator tessellator1, CelestialBody body, double angle, double zIndex,
        double scale, double phaseAngle) {

    // at a scale of 0.15, the body is about 2x2 pixels
    // so this is rather generous, I think
    if(scale < 0.13D) {
        return;
    }


    boolean usePhaseOverlay = true;
    GL11.glPushMatrix();

    final double overlayScale = scale+0.001D;

    //GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);   // change this for your colour
    //GL11.glLineWidth(2.0F);
    // rotate on x
    GL11.glRotatef((float) (angle/Math.PI*180), 1.0F, 0.0F, 0.0F);

    Vector3 color = AmunRa.config.sunColorMap.get(body.getName());
    if(body instanceof Star && color == null) {
        color = new Vector3(1.0F, 0.4F, 0.1F);
    }
    if(color != null) {
        renderSunAura(tessellator1, color, scale*5.0D, scale, zIndex);
        usePhaseOverlay = false;
    }

    //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_DST_ALPHA);
    //OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);



    // actual planet
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(body.getBodyIcon());


    GL11.glTranslatef(0, 0, 0);

    tessellator1.startDrawingQuads();
    // planetSkyColor
    //tessellator1.setColorRGBA_F((float)planetSkyColor.xCoord, (float)planetSkyColor.yCoord, (float)planetSkyColor.zCoord, 1.0F);
    tessellator1.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
    tessellator1.addVertexWithUV(-scale, zIndex, -scale, 0, 0);
    tessellator1.addVertexWithUV(scale, zIndex, -scale, 1, 0);
    tessellator1.addVertexWithUV(scale, zIndex, scale, 1, 1);
    tessellator1.addVertexWithUV(-scale, zIndex, scale, 0, 1);
    tessellator1.draw();

    // actual planet END

    // phase overlay
    if(usePhaseOverlay) {
        drawPhaseOverlay(phaseAngle, body, scale+0.01D, tessellator1, zIndex);
    }
    // phase overlay END

    RingsRenderInfo ringTex = AmunRa.config.ringMap.get(body.getName());
    if(ringTex != null) {
        renderRing(tessellator1, ringTex, angle, zIndex, overlayScale, phaseAngle);
    }

    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glPopMatrix();


}
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:74,
代码来源:SkyProviderDynamic.java

示例13: initVars

点赞 2

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
@Override
protected void initVars() {

    if(((Mothership)curBody).isInTransit()) {
        curBodyPlanet = null;
        curSystem = null;
        mothershipParent = null;
        isInTransit = true;
        curWorldTime = -1;

        if(((MothershipWorldProvider)worldProvider).getTheoreticalTransitData() != null) {
            jetDirection = ((MothershipWorldProvider)worldProvider).getTheoreticalTransitData().direction;
        } else {
            jetDirection = -1;
        }
        clearAsteroidRenderList();
    } else {
        mothershipParent = ((Mothership)curBody).getParent();
        if(mothershipParent instanceof Planet) {
            // pretend we are the planet itself
            this.rType = RenderType.PLANET;
            curBodyPlanet = ((Mothership)curBody).getParent();
            curSystem = ((Planet)mothershipParent).getParentSolarSystem();

            // but use the distance from the planet
            curBodyDistance = mothershipParent.getRelativeDistanceFromCenter().unScaledDistance;

            this.sunSize = 1.0F / curBodyDistance;
        } else if(mothershipParent instanceof Moon) {
            // pretend we are a sibling moon
            this.rType = RenderType.MOON;
            curBodyPlanet = ((Moon)mothershipParent).getParentPlanet();
            curSystem = ((Moon)mothershipParent).getParentPlanet().getParentSolarSystem();

            curBodyDistance = curBodyPlanet.getRelativeDistanceFromCenter().unScaledDistance;

            this.sunSize = 1.0F / curBodyDistance;
        } else if(mothershipParent instanceof Star) {
            // pretend we are a star?
            this.rType = RenderType.STAR;
            curBodyPlanet = curBody;
            curSystem = ((Star)mothershipParent).getParentSolarSystem();
            curBodyDistance = curBody.getRelativeDistanceFromCenter().unScaledDistance;

            this.sunSize = 5;
        }
        checkAsteroidRendering(mothershipParent);

        isInTransit = false;
    }

    this.hasAtmosphere = false;

}
 

开发者ID:katzenpapst,
项目名称:amunra,
代码行数:55,
代码来源:SkyProviderMothership.java

示例14: init

点赞 2

import micdoodle8.mods.galacticraft.api.galaxies.Star; //导入依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent event) {
	ExoCore.gliese581g = new SolarSystem("gliese581g", "milkyWay").setMapPosition(new Vector3(0.1F, 0.1F));
	Star star581g = (Star) new Star("581g").setParentSolarSystem(ExoCore.gliese581g).setTierRequired(-1);
	star581g.setBodyIcon(new ResourceLocation(ExoCore.ASSET_PREFIX, "textures/gui/celestialbodies/star581.png"));
	ExoCore.gliese581g.setMainStar(star581g);
	GalaxyRegistry.registerSolarSystem(ExoCore.gliese581g);

	ExoCore.moonElpis_M1 = (Moon) new Moon("elpis_m1").setParentPlanet(ElipseCore.planetElpis).setRelativeSize(0.1656F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(17F, 17F)).setRelativeOrbitTime(1 / 0.001125F);
	ExoCore.moonElpis_M1.setBodyIcon(new ResourceLocation(ExoCore.ASSET_PREFIX, "textures/gui/celestialbodies/moons581.png"));
	GalaxyRegistry.registerMoon(ExoCore.moonElpis_M1);

	ExoCore.planetHestia = (Planet) new Planet("hestia").setParentSolarSystem(ExoCore.gliese581g).setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(3.9F).setRelativeSize(0.4319F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(0.7F, 0.7F)).setRelativeOrbitTime(3.86199F);
	ExoCore.planetHestia.setBodyIcon(new ResourceLocation(ExoCore.ASSET_PREFIX, "textures/gui/celestialbodies/hestia.png"));
	ExoCore.planetHestia.atmosphereComponent(IAtmosphericGas.CO2);
	GalaxyRegistry.registerPlanet(ExoCore.planetHestia);

	ExoCore.moonHestia_M1 = (Moon) new Moon("hestia_m1").setParentPlanet(ExoCore.planetHestia).setRelativeSize(0.1656F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(17F, 24F)).setRelativeOrbitTime(1 / 0.001125F);
	ExoCore.moonHestia_M1.setBodyIcon(new ResourceLocation(ExoCore.ASSET_PREFIX, "textures/gui/celestialbodies/moons581.png"));
	GalaxyRegistry.registerMoon(ExoCore.moonHestia_M1);

	ExoCore.planetHera = (Planet) new Planet("hera").setParentSolarSystem(ExoCore.gliese581g).setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(99.7F).setRelativeSize(0.7319F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(1.1F, 1.1F)).setRelativeOrbitTime(6.86199F);
	ExoCore.planetHera.setBodyIcon(new ResourceLocation(ExoCore.ASSET_PREFIX, "textures/gui/celestialbodies/hera.png"));
	ExoCore.planetHera.atmosphereComponent(IAtmosphericGas.OXYGEN).atmosphereComponent(IAtmosphericGas.WATER).atmosphereComponent(IAtmosphericGas.CO2).atmosphereComponent(IAtmosphericGas.NITROGEN).atmosphereComponent(IAtmosphericGas.ARGON);
	GalaxyRegistry.registerPlanet(ExoCore.planetHera);

	ExoCore.moonHera_M1 = (Moon) new Moon("hera_m1").setParentPlanet(ExoCore.planetHera).setRelativeSize(0.1656F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(14F, 16F)).setRelativeOrbitTime(1 / 0.001125F);
	ExoCore.moonHera_M1.setBodyIcon(new ResourceLocation(ExoCore.ASSET_PREFIX, "textures/gui/celestialbodies/moons581.png"));
	GalaxyRegistry.registerMoon(ExoCore.moonHera_M1);

	ExoCore.moonHera_M2 = (Moon) new Moon("hera_m2").setParentPlanet(ExoCore.planetHera).setRelativeSize(0.1656F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(23F, 24F)).setRelativeOrbitTime(8 / 0.001125F);
	ExoCore.moonHera_M2.setBodyIcon(new ResourceLocation(ExoCore.ASSET_PREFIX, "textures/gui/celestialbodies/moons581.png"));
	GalaxyRegistry.registerMoon(ExoCore.moonHera_M2);

	ExoCore.planetCeto = (Planet) new Planet("ceto").setParentSolarSystem(ExoCore.gliese581g).setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(7.9F).setRelativeSize(0.6319F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(1.75F, 2.5F)).setRelativeOrbitTime(9.86199F);
	ExoCore.planetCeto.setBodyIcon(new ResourceLocation(ExoCore.ASSET_PREFIX, "textures/gui/celestialbodies/ceto.png"));
	ExoCore.planetCeto.atmosphereComponent(IAtmosphericGas.HYDROGEN).atmosphereComponent(IAtmosphericGas.HELIUM).atmosphereComponent(IAtmosphericGas.NITROGEN);
	GalaxyRegistry.registerPlanet(ExoCore.planetCeto);

	ExoCore.moonCeto_M1 = (Moon) new Moon("ceto_m1").setParentPlanet(ExoCore.planetCeto).setRelativeSize(0.1656F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(17F, 16F)).setRelativeOrbitTime(1 / 0.001125F);
	ExoCore.moonCeto_M1.setBodyIcon(new ResourceLocation(ExoCore.ASSET_PREFIX, "textures/gui/celestialbodies/moons581.png"));
	GalaxyRegistry.registerMoon(ExoCore.moonCeto_M1);

	this.proxy.init(event);
}
 

开发者ID:4Space,
项目名称:4Space-1.7,
代码行数:46,
代码来源:ExoCore.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)