Search in sources :

Example 1 with IConstellation

use of hellfirepvp.astralsorcery.common.constellation.IConstellation in project gugu-utils by ParaParty.

the class GuiStarlightInputHatch method drawScreen.

@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    drawDefaultBackground();
    super.drawScreen(mouseX, mouseY, partialTicks);
    renderHoveredToolTip(mouseX, mouseY);
    if (mouseX > guiLeft + 56 && mouseX < guiLeft + 120 && mouseY > guiTop + 4 && mouseY < guiTop + 68) {
        IConstellation c = container.getClientFocusedConstellation();
        if (c != null && ResearchManager.clientProgress.hasConstellationDiscovered(c.getUnlocalizedName())) {
            drawHoveringText(Collections.singletonList(I18n.format(c.getUnlocalizedName())), mouseX, mouseY, fontRenderer);
        }
    } else if (mouseX > guiLeft + 10 && mouseX < guiLeft + 168 && mouseY > guiTop + 70 && mouseY < guiTop + 77) {
        drawHoveringText(Collections.singletonList(I18n.format(KEY_TOOLTIP_STARLIGHT, hatch.getStarlightStored())), mouseX, mouseY, fontRenderer);
    }
}
Also used : IConstellation(hellfirepvp.astralsorcery.common.constellation.IConstellation)

Example 2 with IConstellation

use of hellfirepvp.astralsorcery.common.constellation.IConstellation in project gugu-utils by ParaParty.

the class GuiStarlightInputHatch method drawGuiContainerForegroundLayer.

@Override
public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    TextureHelper.refreshTextureBindState();
    float pTicks = Minecraft.getMinecraft().getRenderPartialTicks();
    RenderAstralSkybox.TEX_STAR_1.bind();
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    Blending.DEFAULT.apply();
    rand.setSeed(0x889582997FF29A92L);
    for (int i = 0; i < 16; i++) {
        int x = rand.nextInt(54);
        int y = rand.nextInt(54);
        GL11.glPushMatrix();
        float brightness = 0.3F + (RenderConstellation.stdFlicker(ClientScheduler.getClientTick(), pTicks, 10 + rand.nextInt(20))) * 0.6F;
        GL11.glColor4f(brightness, brightness, brightness, brightness);
        RenderUtils.drawRect(60 + x, 7 + y, zLevel, 5, 5);
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glPopMatrix();
    }
    GL11.glPopAttrib();
    TextureHelper.refreshTextureBindState();
    IConstellation c = container.getClientFocusedConstellation();
    if (c != null && ResearchManager.clientProgress.hasConstellationDiscovered(c.getUnlocalizedName())) {
        rand.setSeed(0x61FF25A5B7C24109L);
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
        GL11.glPushMatrix();
        GL11.glColor4f(1F, 1F, 1F, 1F);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        Blending.DEFAULT.apply();
        RenderConstellation.renderConstellationIntoGUI(c, 61, 9, zLevel, 58, 58, 2, new RenderConstellation.BrightnessFunction() {

            @Override
            public float getBrightness() {
                return RenderConstellation.conCFlicker(Minecraft.getMinecraft().world.getTotalWorldTime(), pTicks, 5 + rand.nextInt(5));
            }
        }, true, false);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glPopMatrix();
        GL11.glPopAttrib();
    }
    TextureHelper.setActiveTextureToAtlasSprite();
    TextureHelper.refreshTextureBindState();
}
Also used : RenderConstellation(hellfirepvp.astralsorcery.client.util.RenderConstellation) IConstellation(hellfirepvp.astralsorcery.common.constellation.IConstellation)

Example 3 with IConstellation

use of hellfirepvp.astralsorcery.common.constellation.IConstellation in project gugu-utils by ParaParty.

the class RequirementTypeStarlight method gererateRequirementPerTick.

@Override
public ComponentRequirementAdapter.PerTick<Integer> gererateRequirementPerTick(IOType type, JsonObject obj) {
    JsonPrimitive constellationStr = tryGet(obj, "constellation", false);
    IConstellation constellation = null;
    if (constellationStr != null && constellationStr.isString()) {
        constellation = ConstellationRegistry.getConstellationByName(constellationStr.getAsString());
        if (constellation == null) {
            GuGuUtils.logger.warn("Couldn't find constellation " + constellationStr.getAsString());
        }
    }
    return new RequirementStarlight(tryGet(obj, "starlight", true).getAsInt(), constellation, type);
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) RequirementStarlight(com.warmthdawn.mod.gugu_utils.modularmachenary.requirements.RequirementStarlight) IConstellation(hellfirepvp.astralsorcery.common.constellation.IConstellation)

Example 4 with IConstellation

use of hellfirepvp.astralsorcery.common.constellation.IConstellation in project AstralSorcery by HellFirePvP.

the class ActivePlayerAttunementRecipe method doEffectTick.

@OnlyIn(Dist.CLIENT)
private void doEffectTick(TileAttunementAltar altar) {
    IConstellation cst = altar.getActiveConstellation();
    if (cst == null) {
        return;
    }
    Vector3 playerTarget = new Vector3(altar).add(0.5, 2.5, 0.5);
    VFXColorFunction<?> beamColor = VFXColorFunction.constant(ColorsAS.DEFAULT_GENERIC_PARTICLE);
    int tick = getTick();
    if (tick % 40 == 0) {
        for (BlockPos pos : altar.getConstellationPositions(cst)) {
            Vector3 from = new Vector3(pos).add(0.5, 0, 0.5);
            MiscUtils.applyRandomOffset(from, rand, 0.1F);
            EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).spawn(from).setup(from.clone().addY(6), 1.2, 1.2).setAlphaMultiplier(0.8F).color(beamColor).setMaxAge(60);
        }
    }
    double scale = 7.0D;
    double edgeScale = (scale * 2 + 1);
    for (int i = 0; i < 7; i++) {
        Vector3 offset = new Vector3(altar).add(-scale, 0.1, -scale);
        if (rand.nextBoolean()) {
            offset.add(edgeScale * (rand.nextBoolean() ? 1 : 0), 0, rand.nextFloat() * edgeScale);
        } else {
            offset.add(rand.nextFloat() * edgeScale, 0, edgeScale * (rand.nextBoolean() ? 1 : 0));
        }
        FXFacingParticle particle = EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).alpha(VFXAlphaFunction.FADE_OUT).setGravityStrength(-0.0002F + rand.nextFloat() * -0.0001F).setScaleMultiplier(0.3F + rand.nextFloat() * 0.15F).color(VFXColorFunction.WHITE).setMaxAge(40 + rand.nextInt(10));
        if (rand.nextBoolean()) {
            particle.color(VFXColorFunction.constant(this.constellation.getConstellationColor()));
        }
    }
    for (int i = 0; i < 5; i++) {
        Set<BlockPos> offsets = altar.getConstellationPositions(cst);
        BlockPos pos = MiscUtils.getRandomEntry(offsets, rand);
        if (tick <= 380) {
            Vector3 offset = new Vector3(pos).add(0.5, 0, 0.5).add(Vector3.random().setY(0).multiply(0.6));
            EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).color(VFXColorFunction.WHITE).setGravityStrength(-0.0006F + rand.nextFloat() * -0.003F).setMotion(Vector3.random().addY(4).normalize().multiply(0.015 + rand.nextFloat() * 0.01)).setAlphaMultiplier(0.6F).setScaleMultiplier(0.3F + rand.nextFloat() * 0.15F).alpha(VFXAlphaFunction.FADE_OUT).setMaxAge(60 + rand.nextInt(20));
        } else {
            Vector3 offset = new Vector3(pos).add(0.5, 0, 0.5).add(Vector3.random().setY(0).multiply(0.5));
            EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).setAlphaMultiplier(0.6F).alpha(VFXAlphaFunction.proximity(playerTarget::clone, 3F)).motion(VFXMotionController.target(playerTarget::clone, 0.08F)).setScaleMultiplier(0.2F + rand.nextFloat() * 0.1F).color(VFXColorFunction.WHITE).setMotion(new Vector3(0, 0.2 + rand.nextFloat() * 0.15F, 0)).setMaxAge(60 + rand.nextInt(20));
            offset = new Vector3(altar).add(0.5, 0, 0.5).add(Vector3.random().setY(0).multiply(0.6));
            EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).color(VFXColorFunction.WHITE).setGravityStrength(-0.0006F + rand.nextFloat() * -0.004F).setMotion(Vector3.random().addY(4).normalize().multiply(0.02 + rand.nextFloat() * 0.01)).setAlphaMultiplier(0.75F).setScaleMultiplier(0.3F + rand.nextFloat() * 0.1F).alpha(VFXAlphaFunction.FADE_OUT).setMaxAge(40 + rand.nextInt(10));
        }
    }
    if (tick >= 220) {
        Vector3 offset = new Vector3(altar).add(0.5, 0, 0.5).add(Vector3.random().setY(0));
        FXFacingParticle p = EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(offset).setAlphaMultiplier(1F).alpha(VFXAlphaFunction.proximity(playerTarget::clone, 3F)).motion(VFXMotionController.target(playerTarget::clone, 0.1F)).setScaleMultiplier(0.2F + rand.nextFloat() * 0.1F).color(VFXColorFunction.WHITE).setMotion(Vector3.positiveYRandom().setY(1).normalize().multiply(0.5F + rand.nextFloat() * 0.1F)).setMaxAge(60 + rand.nextInt(20));
        if (rand.nextBoolean()) {
            p.color(VFXColorFunction.constant(this.constellation.getConstellationColor()));
        }
        for (int i = 0; i < 3; i++) {
            Vector3 at = new Vector3(altar).add(0.5, 0, 0.5);
            at.addX(rand.nextFloat() * 7F * (rand.nextBoolean() ? 1 : -1));
            at.addZ(rand.nextFloat() * 7F * (rand.nextBoolean() ? 1 : -1));
            p = EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(at).setAlphaMultiplier(0.75F).alpha(VFXAlphaFunction.FADE_OUT).setGravityStrength(-0.001F + rand.nextFloat() * -0.0005F).color(VFXColorFunction.WHITE).setScaleMultiplier(0.3F + rand.nextFloat() * 0.1F).setMaxAge(20 + rand.nextInt(10));
            if (rand.nextBoolean()) {
                p.color(VFXColorFunction.constant(this.constellation.getConstellationColor()));
            }
            if (tick >= 500) {
                p.setScaleMultiplier(0.3F + rand.nextFloat() * 0.15F);
            }
        }
    }
    if (tick >= 400) {
        int amt = tick >= 500 ? 4 : 1;
        for (int i = 0; i < amt; i++) {
            RenderOffsetNoisePlane plane = (RenderOffsetNoisePlane) MiscUtils.getRandomEntry(this.playerNoisePlanes, rand);
            FXFacingParticle p = plane.createParticle(playerTarget.clone()).setMotion(Vector3.random().setY(0).multiply(rand.nextFloat() * 0.015F)).setAlphaMultiplier(0.6F).setScaleMultiplier(0.2F + rand.nextFloat() * 0.05F).alpha(VFXAlphaFunction.FADE_OUT).setMaxAge(60 + rand.nextInt(20));
            if (rand.nextBoolean()) {
                p.color(VFXColorFunction.constant(this.constellation.getConstellationColor()));
            }
        }
    }
    if (tick >= 600) {
        if (tick % 10 == 0) {
            Vector3 from = new Vector3(altar).add(0.5, 0, 0.5);
            MiscUtils.applyRandomOffset(from, rand, 0.25F);
            EffectHelper.of(EffectTemplatesAS.LIGHTBEAM).spawn(from).setup(from.clone().addY(8), 2.4, 2).setAlphaMultiplier(0.8F).setMaxAge(40 + rand.nextInt(20));
        }
    }
    if (tick >= (DURATION_PLAYER_ATTUNEMENT - 4)) {
        for (int i = 0; i < 60; i++) {
            Vector3 at = new Vector3(altar).add(0.5, 0, 0.5).addY(rand.nextFloat() * 15);
            FXFacingParticle p = EffectHelper.of(EffectTemplatesAS.GENERIC_PARTICLE).spawn(at).color(VFXColorFunction.WHITE).setMotion(Vector3.random().setY(0).normalize().multiply(0.03 + rand.nextFloat() * 0.01)).setAlphaMultiplier(0.7F).setScaleMultiplier(0.3F + rand.nextFloat() * 0.15F).alpha(VFXAlphaFunction.FADE_OUT).setMaxAge(140 + rand.nextInt(60));
            if (rand.nextBoolean()) {
                p.color(VFXColorFunction.constant(this.constellation.getConstellationColor()));
            }
        }
    }
}
Also used : RenderOffsetNoisePlane(hellfirepvp.astralsorcery.client.effect.function.impl.RenderOffsetNoisePlane) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) BlockPos(net.minecraft.util.math.BlockPos) FXFacingParticle(hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle) IConstellation(hellfirepvp.astralsorcery.common.constellation.IConstellation) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 5 with IConstellation

use of hellfirepvp.astralsorcery.common.constellation.IConstellation in project AstralSorcery by HellFirePvP.

the class ContainerTome method slotChanged.

public void slotChanged() {
    if (EffectiveSide.get().isServer()) {
        LinkedList<IConstellation> saveConstellations = new LinkedList<>();
        for (int i = 36; i < 63; i++) {
            ItemStack in = inventorySlots.get(i).getStack();
            if (in.isEmpty()) {
                continue;
            }
            if (!(in.getItem() instanceof ConstellationBaseItem)) {
                continue;
            }
            IConstellation c = ((ConstellationBaseItem) in.getItem()).getConstellation(in);
            if (c != null) {
                saveConstellations.add(c);
            }
        }
        ResearchManager.updateConstellationPapers(saveConstellations, this.owningPlayer);
    }
}
Also used : ConstellationBaseItem(hellfirepvp.astralsorcery.common.constellation.ConstellationBaseItem) ItemStack(net.minecraft.item.ItemStack) LinkedList(java.util.LinkedList) IConstellation(hellfirepvp.astralsorcery.common.constellation.IConstellation)

Aggregations

IConstellation (hellfirepvp.astralsorcery.common.constellation.IConstellation)57 ResourceLocation (net.minecraft.util.ResourceLocation)14 ItemStack (net.minecraft.item.ItemStack)9 IWeakConstellation (hellfirepvp.astralsorcery.common.constellation.IWeakConstellation)8 Vector3 (hellfirepvp.astralsorcery.common.util.data.Vector3)8 WorldContext (hellfirepvp.astralsorcery.common.constellation.world.WorldContext)7 PlayerProgress (hellfirepvp.astralsorcery.common.data.research.PlayerProgress)7 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)7 JsonArray (com.google.gson.JsonArray)5 Nullable (javax.annotation.Nullable)5 BlockPos (net.minecraft.util.math.BlockPos)5 DrawnConstellation (hellfirepvp.astralsorcery.common.constellation.DrawnConstellation)4 StarLocation (hellfirepvp.astralsorcery.common.constellation.star.StarLocation)4 ActiveSimpleAltarRecipe (hellfirepvp.astralsorcery.common.crafting.recipe.altar.ActiveSimpleAltarRecipe)4 CompoundNBT (net.minecraft.nbt.CompoundNBT)4 JsonElement (com.google.gson.JsonElement)3 PlayerAngledConstellationInformation (hellfirepvp.astralsorcery.client.screen.telescope.PlayerAngledConstellationInformation)3 ListNBT (net.minecraft.nbt.ListNBT)3 JsonObject (com.google.gson.JsonObject)2 JsonParseException (com.google.gson.JsonParseException)2