Search in sources :

Example 11 with Vector3

use of hellfirepvp.fracture.common.util.Vector3 in project SomeModjam5Mod by HellFirePvP.

the class RenderingUtils method renderFacingQuadVB.

public static void renderFacingQuadVB(BufferBuilder vb, double px, double py, double pz, float partialTicks, float scale, float angle, double u, double v, double uLength, double vLength, float colorRed, float colorGreen, float colorBlue, float alpha) {
    float arX = ActiveRenderInfo.getRotationX();
    float arZ = ActiveRenderInfo.getRotationZ();
    float arYZ = ActiveRenderInfo.getRotationYZ();
    float arXY = ActiveRenderInfo.getRotationXY();
    float arXZ = ActiveRenderInfo.getRotationXZ();
    Entity e = Minecraft.getMinecraft().getRenderViewEntity();
    if (e == null) {
        e = Minecraft.getMinecraft().player;
    }
    double iPX = e.prevPosX + (e.posX - e.prevPosX) * partialTicks;
    double iPY = e.prevPosY + (e.posY - e.prevPosY) * partialTicks;
    double iPZ = e.prevPosZ + (e.posZ - e.prevPosZ) * partialTicks;
    Vector3 v1 = new Vector3(-arX * scale - arYZ * scale, -arXZ * scale, -arZ * scale - arXY * scale);
    Vector3 v2 = new Vector3(-arX * scale + arYZ * scale, arXZ * scale, -arZ * scale + arXY * scale);
    Vector3 v3 = new Vector3(arX * scale + arYZ * scale, arXZ * scale, arZ * scale + arXY * scale);
    Vector3 v4 = new Vector3(arX * scale - arYZ * scale, -arXZ * scale, arZ * scale - arXY * scale);
    if (angle != 0.0F) {
        Vector3 pvec = new Vector3(iPX, iPY, iPZ);
        Vector3 tvec = new Vector3(px, py, pz);
        Vector3 qvec = pvec.subtract(tvec).normalize();
        Vector3.Quat q = Vector3.Quat.buildQuatFrom3DVector(qvec, angle);
        q.rotateWithMagnitude(v1);
        q.rotateWithMagnitude(v2);
        q.rotateWithMagnitude(v3);
        q.rotateWithMagnitude(v4);
    }
    vb.pos(px + v1.getX() - iPX, py + v1.getY() - iPY, pz + v1.getZ() - iPZ).tex(u + uLength, v + vLength).color(colorRed, colorGreen, colorBlue, alpha).endVertex();
    vb.pos(px + v2.getX() - iPX, py + v2.getY() - iPY, pz + v2.getZ() - iPZ).tex(u + uLength, v).color(colorRed, colorGreen, colorBlue, alpha).endVertex();
    vb.pos(px + v3.getX() - iPX, py + v3.getY() - iPY, pz + v3.getZ() - iPZ).tex(u, v).color(colorRed, colorGreen, colorBlue, alpha).endVertex();
    vb.pos(px + v4.getX() - iPX, py + v4.getY() - iPY, pz + v4.getZ() - iPZ).tex(u, v + vLength).color(colorRed, colorGreen, colorBlue, alpha).endVertex();
}
Also used : Entity(net.minecraft.entity.Entity) Vector3(hellfirepvp.fracture.common.util.Vector3)

Example 12 with Vector3

use of hellfirepvp.fracture.common.util.Vector3 in project SomeModjam5Mod by HellFirePvP.

the class RenderingUtils method getStandartTranslationRemovalVector.

public static Vector3 getStandartTranslationRemovalVector(float partialTicks) {
    Entity rView = Minecraft.getMinecraft().getRenderViewEntity();
    if (rView == null)
        rView = Minecraft.getMinecraft().player;
    Entity entity = rView;
    double tx = entity.lastTickPosX + ((entity.posX - entity.lastTickPosX) * partialTicks);
    double ty = entity.lastTickPosY + ((entity.posY - entity.lastTickPosY) * partialTicks);
    double tz = entity.lastTickPosZ + ((entity.posZ - entity.lastTickPosZ) * partialTicks);
    return new Vector3(-tx, -ty, -tz);
}
Also used : Entity(net.minecraft.entity.Entity) Vector3(hellfirepvp.fracture.common.util.Vector3)

Example 13 with Vector3

use of hellfirepvp.fracture.common.util.Vector3 in project SomeModjam5Mod by HellFirePvP.

the class TileFissureDevice method setupCube.

@SideOnly(Side.CLIENT)
private Object setupCube(float baseScale, float scaleGrow) {
    EntityFXFloatingCube cube = new EntityFXFloatingCube(10, AssetLibrary.loadTexture(AssetLoader.TextureLocation.BLOCKS, "core_edge"));
    cube.setRefreshFunction(() -> Minecraft.getMinecraft().player != null && Minecraft.getMinecraft().player.world.provider.getDimension() == this.world.provider.getDimension() && Minecraft.getMinecraft().world.getTileEntity(getPos()) instanceof TileFissureDevice && !Minecraft.getMinecraft().world.getTileEntity(getPos()).isInvalid() && ((TileFissureDevice) Minecraft.getMinecraft().world.getTileEntity(getPos())).getStructureDepth() > 0 && Minecraft.getMinecraft().world.getTileEntity(getPos()) == TileFissureDevice.this);
    cube.setPosition(new Vector3(this).add(0.5, 0.8, 0.5));
    cube.setPositionController((fx, position, motionToBeMoved) -> {
        Vector3 base = new Vector3(TileFissureDevice.this).add(0.5, 0.8, 0.5);
        base.addY(percActive * 0.5);
        return base;
    });
    cube.setScaleFunction((fx, pTicks, scaleIn) -> baseScale + baseScale * (percActive * scaleGrow));
    cube.tumble();
    EffectHandler.getInstance().registerFX(cube);
    return cube;
}
Also used : EntityFXFloatingCube(hellfirepvp.fracture.client.effect.fx.EntityFXFloatingCube) Vector3(hellfirepvp.fracture.common.util.Vector3) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 14 with Vector3

use of hellfirepvp.fracture.common.util.Vector3 in project SomeModjam5Mod by HellFirePvP.

the class TileFissureDevice method setupOuterCube.

@SideOnly(Side.CLIENT)
private Object setupOuterCube(int radius) {
    EntityFXFloatingCube cube = new EntityFXFloatingCube(10, AssetLibrary.loadTexture(AssetLoader.TextureLocation.BLOCKS, "core_edge"));
    cube.setRefreshFunction(() -> Minecraft.getMinecraft().player != null && Minecraft.getMinecraft().player.world.provider.getDimension() == this.world.provider.getDimension() && Minecraft.getMinecraft().world.getTileEntity(getPos()) instanceof TileFissureDevice && !Minecraft.getMinecraft().world.getTileEntity(getPos()).isInvalid() && ((TileFissureDevice) Minecraft.getMinecraft().world.getTileEntity(getPos())).getStructureDepth() > 0 && Minecraft.getMinecraft().world.getTileEntity(getPos()) == TileFissureDevice.this);
    cube.setAlphaMultiplier(0F);
    cube.setPosition(new Vector3(getPos()).add(0.5, 0.5, 0.5));
    cube.setScale(radius * 2);
    cube.setTumbleIntensityMultiplier(0.04F);
    cube.setColor(new Color(0x2DE400));
    cube.tumble();
    EffectHandler.getInstance().registerFX(cube);
    return cube;
}
Also used : EntityFXFloatingCube(hellfirepvp.fracture.client.effect.fx.EntityFXFloatingCube) Vector3(hellfirepvp.fracture.common.util.Vector3) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 15 with Vector3

use of hellfirepvp.fracture.common.util.Vector3 in project SomeModjam5Mod by HellFirePvP.

the class EffectLightning method renderCurrentTextureAroundAxis.

private void renderCurrentTextureAroundAxis(Vector3 from, Vector3 to, double angle, double size, BufferBuilder buf) {
    Vector3 aim = to.clone().subtract(from).normalize();
    Vector3 aimPerp = aim.clone().perpendicular().normalize();
    Vector3 perp = aimPerp.clone().rotate(angle, aim).normalize();
    Vector3 perpFrom = perp.clone().multiply(size);
    Vector3 perpTo = perp.multiply(size);
    Vector3 vec = from.clone().add(perpFrom.clone().multiply(-1));
    buf.pos(vec.getX(), vec.getY(), vec.getZ()).tex(1, 1).color(ovR, ovG, ovB, 1F).endVertex();
    vec = from.clone().add(perpFrom);
    buf.pos(vec.getX(), vec.getY(), vec.getZ()).tex(1, 0).color(ovR, ovG, ovB, 1F).endVertex();
    vec = to.clone().add(perpTo);
    buf.pos(vec.getX(), vec.getY(), vec.getZ()).tex(0, 0).color(ovR, ovG, ovB, 1F).endVertex();
    vec = to.clone().add(perpTo.clone().multiply(-1));
    buf.pos(vec.getX(), vec.getY(), vec.getZ()).tex(0, 1).color(ovR, ovG, ovB, 1F).endVertex();
}
Also used : Vector3(hellfirepvp.fracture.common.util.Vector3)

Aggregations

Vector3 (hellfirepvp.fracture.common.util.Vector3)23 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)6 EffectLightning (hellfirepvp.fracture.client.effect.fx.EffectLightning)4 EntityFXFacingParticle (hellfirepvp.fracture.client.effect.fx.EntityFXFacingParticle)4 EntityFXFloatingCube (hellfirepvp.fracture.client.effect.fx.EntityFXFloatingCube)4 Entity (net.minecraft.entity.Entity)4 FissureData (hellfirepvp.fracture.common.fissure.FissureData)3 LinkedList (java.util.LinkedList)3 Random (java.util.Random)2 Vec3i (net.minecraft.util.math.Vec3i)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 IBlockState (net.minecraft.block.state.IBlockState)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1