Search in sources :

Example 1 with SpriteSheetResource

use of hellfirepvp.astralsorcery.client.resource.SpriteSheetResource in project AstralSorcery by HellFirePvP.

the class FXLightbeam method renderCurrentTextureAroundAxis.

private <T extends EntityVisualFX> void renderCurrentTextureAroundAxis(IVertexBuilder vb, MatrixStack renderStack, BatchRenderContext<T> ctx, Vector3 renderOffset, double angle, float scale, int r, int g, int b, int a) {
    Vector3 perp = aimPerp.clone().rotate(angle, aim).normalize();
    Vector3 perpTo = perp.clone().multiply(toSize * scale);
    Vector3 perpFrom = perp.multiply(fromSize * scale);
    SpriteSheetResource ssr = ctx.getSprite();
    Tuple<Float, Float> uvOffset = ssr.getUVOffset(age);
    float u = uvOffset.getA();
    float v = uvOffset.getB();
    float uWidth = ssr.getULength();
    float vHeight = ssr.getVLength();
    Matrix4f matr = renderStack.getLast().getMatrix();
    Vector3 vec = to.clone().add(perpTo.clone().multiply(-1)).subtract(renderOffset);
    vec.drawPos(matr, vb).color(r, g, b, a).tex(u, v + vHeight).endVertex();
    vec = to.clone().add(perpTo).subtract(renderOffset);
    vec.drawPos(matr, vb).color(r, g, b, a).tex(u + uWidth, v + vHeight).endVertex();
    vec = from.clone().add(perpFrom).subtract(renderOffset);
    vec.drawPos(matr, vb).color(r, g, b, a).tex(u + uWidth, v).endVertex();
    vec = from.clone().add(perpFrom.clone().multiply(-1)).subtract(renderOffset);
    vec.drawPos(matr, vb).color(r, g, b, a).tex(u, v).endVertex();
}
Also used : SpriteSheetResource(hellfirepvp.astralsorcery.client.resource.SpriteSheetResource) Matrix4f(net.minecraft.util.math.vector.Matrix4f) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3)

Example 2 with SpriteSheetResource

use of hellfirepvp.astralsorcery.client.resource.SpriteSheetResource in project AstralSorcery by HellFirePvP.

the class ScreenJournalPerkTree method drawSearchHalo.

private void drawSearchHalo(BatchPerkContext ctx, MatrixStack renderStack, float size, float x, float y) {
    BufferContext batch = ctx.getContext(searchContext);
    SpriteSheetResource searchMark = SpritesAS.SPR_PERK_SEARCH;
    searchMark.bindTexture();
    Vector3 starVec = new Vector3(x - size, y - size, 0);
    float uLength = searchMark.getUWidth();
    float vLength = searchMark.getVWidth();
    Tuple<Float, Float> frameUV = searchMark.getUVOffset();
    Matrix4f offset = renderStack.getLast().getMatrix();
    for (int i = 0; i < 4; i++) {
        int u = ((i + 1) & 2) >> 1;
        int v = ((i + 2) & 2) >> 1;
        Vector3 pos = starVec.clone().addX(size * u * 2).addY(size * v * 2);
        pos.drawPos(offset, batch).color(0.8F, 0.1F, 0.1F, 1F).tex(frameUV.getA() + uLength * u, frameUV.getB() + vLength * v).endVertex();
    }
}
Also used : SpriteSheetResource(hellfirepvp.astralsorcery.client.resource.SpriteSheetResource) Matrix4f(net.minecraft.util.math.vector.Matrix4f) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) ScalingPoint(hellfirepvp.astralsorcery.client.screen.helper.ScalingPoint) PerkTreePoint(hellfirepvp.astralsorcery.common.perk.tree.PerkTreePoint) BufferContext(hellfirepvp.astralsorcery.client.util.draw.BufferContext)

Example 3 with SpriteSheetResource

use of hellfirepvp.astralsorcery.client.resource.SpriteSheetResource in project AstralSorcery by HellFirePvP.

the class ScreenJournalPerkTree method drawSeal.

private void drawSeal(BufferBuilder vb, MatrixStack renderStack, double size, double x, double y, long spriteOffsetTick, float alpha) {
    SpriteSheetResource tex = SpritesAS.SPR_PERK_SEAL;
    if (tex == null) {
        return;
    }
    float uLength = tex.getULength();
    float vLength = tex.getVLength();
    Tuple<Float, Float> frameUV = tex.getUVOffset(spriteOffsetTick);
    Vector3 starVec = new Vector3(x - size, y - size, 0);
    Matrix4f offset = renderStack.getLast().getMatrix();
    for (int i = 0; i < 4; i++) {
        int u = ((i + 1) & 2) >> 1;
        int v = ((i + 2) & 2) >> 1;
        Vector3 pos = starVec.clone().addX(size * u * 2).addY(size * v * 2);
        pos.drawPos(offset, vb).color(1F, 1F, 1F, alpha).tex(frameUV.getA() + uLength * u, frameUV.getB() + vLength * v).endVertex();
    }
}
Also used : SpriteSheetResource(hellfirepvp.astralsorcery.client.resource.SpriteSheetResource) Matrix4f(net.minecraft.util.math.vector.Matrix4f) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) ScalingPoint(hellfirepvp.astralsorcery.client.screen.helper.ScalingPoint) PerkTreePoint(hellfirepvp.astralsorcery.common.perk.tree.PerkTreePoint)

Example 4 with SpriteSheetResource

use of hellfirepvp.astralsorcery.client.resource.SpriteSheetResource in project AstralSorcery by HellFirePvP.

the class EffectCustomTexture method renderInventoryEffect.

@Override
@OnlyIn(Dist.CLIENT)
public void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen<?> gui, MatrixStack renderStack, int x, int y, float z) {
    float wh = 18;
    float offsetX = x + 6;
    float offsetY = y + 7;
    float red = ((float) this.colorAsObj.getRed()) / 255F;
    float green = ((float) this.colorAsObj.getGreen()) / 255F;
    float blue = ((float) this.colorAsObj.getBlue()) / 255F;
    SpriteSheetResource ssr = getSpriteQuery().resolveSprite();
    ssr.bindTexture();
    Tuple<Float, Float> uvTpl = ssr.getUVOffset(ClientScheduler.getClientTick());
    RenderingUtils.draw(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX, buf -> {
        RenderingGuiUtils.rect(buf, renderStack, offsetX, offsetY, z, wh, wh).color(red, green, blue, 1F).tex(uvTpl.getA(), uvTpl.getB(), ssr.getUWidth(), ssr.getVWidth()).draw();
    });
}
Also used : SpriteSheetResource(hellfirepvp.astralsorcery.client.resource.SpriteSheetResource) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 5 with SpriteSheetResource

use of hellfirepvp.astralsorcery.client.resource.SpriteSheetResource in project AstralSorcery by HellFirePvP.

the class RegistrySprites method loadSprites.

public static void loadSprites() {
    SPR_CRYSTAL_EFFECT_1 = new SpriteSheetResource(TEX_CRYSTAL_EFFECT_1, 5, 8);
    SPR_CRYSTAL_EFFECT_2 = new SpriteSheetResource(TEX_CRYSTAL_EFFECT_2, 5, 8);
    SPR_CRYSTAL_EFFECT_3 = new SpriteSheetResource(TEX_CRYSTAL_EFFECT_3, 5, 8);
    SPR_GEM_CRYSTAL_BURST = new SpriteSheetResource(TEX_GEM_CRYSTAL_BURST, 5, 8);
    SPR_GEM_CRYSTAL_BURST_SKY = new SpriteSheetResource(TEX_GEM_CRYSTAL_BURST_SKY, 5, 8);
    SPR_GEM_CRYSTAL_BURST_DAY = new SpriteSheetResource(TEX_GEM_CRYSTAL_BURST_DAY, 5, 8);
    SPR_GEM_CRYSTAL_BURST_NIGHT = new SpriteSheetResource(TEX_GEM_CRYSTAL_BURST_NIGHT, 5, 8);
    SPR_PERK_INACTIVE = new SpriteSheetResource(TEX_GUI_PERK_INACTIVE, 5, 8);
    SPR_PERK_ACTIVE = new SpriteSheetResource(TEX_GUI_PERK_ACTIVE, 5, 8);
    SPR_PERK_ACTIVATEABLE = new SpriteSheetResource(TEX_GUI_PERK_ACTIVATEABLE, 5, 8);
    SPR_PERK_HALO_INACTIVE = new SpriteSheetResource(TEX_GUI_PERK_HALO_INACTIVE, 4, 8);
    SPR_PERK_HALO_ACTIVE = new SpriteSheetResource(TEX_GUI_PERK_HALO_ACTIVE, 4, 8);
    SPR_PERK_HALO_ACTIVATEABLE = new SpriteSheetResource(TEX_GUI_PERK_HALO_ACTIVATEABLE, 4, 8);
    SPR_PERK_SEARCH = new SpriteSheetResource(TEX_GUI_PERK_SEARCH, 4, 8);
    SPR_PERK_SEAL = new SpriteSheetResource(TEX_GUI_PERK_SEAL, 4, 8);
    SPR_PERK_SEAL_BREAK = new SpriteSheetResource(TEX_GUI_PERK_SEAL_BREAK, 7, 8);
    SPR_PERK_UNLOCK = new SpriteSheetResource(TEX_GUI_PERK_UNLOCK, 5, 16);
    SPR_COLLECTOR_EFFECT = new SpriteSheetResource(TEX_COLLECTOR_EFFECT, 5, 16);
    SPR_CRAFT_BURST = new SpriteSheetResource(TEX_CRAFT_BURST, 6, 8);
    SPR_CRAFT_FLARE = new SpriteSheetResource(TEX_CRAFT_FLARE, 8, 8);
    SPR_ATTUNEMENT_FLARE = new SpriteSheetResource(TEX_ATTUNEMENT_FLARE, 6, 8);
    SPR_RELAY_FLARE = new SpriteSheetResource(TEX_RELAY_FLARE, 6, 8);
    SPR_LIGHTBEAM = new SpriteSheetResource(TEX_LIGHTBEAM, 4, 16);
    SPR_LIGHTBEAM_TRANSFER = new SpriteSheetResource(TEX_LIGHTBEAM_TRANSFER, 4, 16);
    SPR_ENTITY_FLARE = new SpriteSheetResource(TEX_ENTITY_FLARE, 6, 8);
    SPR_GRAPPLING_HOOK = new SpriteSheetResource(TEX_GRAPPLING_HOOK, 4, 8);
    SPR_HALO_INFUSION = new SpriteSheetResource(TEX_HALO_INFUSION, 8, 8);
    SPR_HALO_RITUAL = new SpriteSheetResource(TEX_HALO_RITUAL, 6, 8);
    SPR_FOUNTAIN_LIQUID = new SpriteSheetResource(TEX_FOUNTAIN_LIQUID, 4, 8);
    SPR_FOUNTAIN_VORTEX = new SpriteSheetResource(TEX_FOUNTAIN_VORTEX, 5, 8);
    SPR_DAZZLING_AURA = new SpriteSheetResource(TEX_DAZZLING_AURA, 4, 4);
    SPR_OVERLAY_CHARGE = new SpriteSheetResource(TEX_OVERLAY_CHARGE, 8, 4);
    SPR_OVERLAY_CHARGE_COLORLESS = new SpriteSheetResource(TEX_OVERLAY_CHARGE_COLORLESS, 8, 4);
    SPR_STARLIGHT_STORE = new SpriteSheetResource(TEX_STARLIGHT_STORE, 16, 4);
}
Also used : SpriteSheetResource(hellfirepvp.astralsorcery.client.resource.SpriteSheetResource)

Aggregations

SpriteSheetResource (hellfirepvp.astralsorcery.client.resource.SpriteSheetResource)19 Vector3 (hellfirepvp.astralsorcery.common.util.data.Vector3)7 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)7 ScalingPoint (hellfirepvp.astralsorcery.client.screen.helper.ScalingPoint)4 BatchPerkContext (hellfirepvp.astralsorcery.client.screen.journal.perk.BatchPerkContext)4 PerkTreePoint (hellfirepvp.astralsorcery.common.perk.tree.PerkTreePoint)4 Nullable (javax.annotation.Nullable)4 Matrix4f (net.minecraft.util.math.vector.Matrix4f)4 IVertexBuilder (com.mojang.blaze3d.vertex.IVertexBuilder)3 BufferContext (hellfirepvp.astralsorcery.client.util.draw.BufferContext)3 RenderTypeDecorator (hellfirepvp.observerlib.client.util.RenderTypeDecorator)2 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)2 AbstractRenderableTexture (hellfirepvp.astralsorcery.client.resource.AbstractRenderableTexture)1 SimpleAltarRecipe (hellfirepvp.astralsorcery.common.crafting.recipe.SimpleAltarRecipe)1 TileAltar (hellfirepvp.astralsorcery.common.tile.altar.TileAltar)1 Nonnull (javax.annotation.Nonnull)1