Search in sources :

Example 26 with Vector3

use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.

the class EntityMeteor method spawnParticles.

protected void spawnParticles() {
    GalacticraftCore.proxy.spawnParticle("distanceSmoke", new Vector3(this.posX, this.posY + 1D + Math.random(), this.posZ), new Vector3(0.0D, 0.0D, 0.0D), new Object[] {});
    GalacticraftCore.proxy.spawnParticle("distanceSmoke", new Vector3(this.posX + Math.random() / 2, this.posY + 1D + Math.random() / 2, this.posZ), new Vector3(0.0D, 0.0D, 0.0D), new Object[] {});
    GalacticraftCore.proxy.spawnParticle("distanceSmoke", new Vector3(this.posX, this.posY + 1D + Math.random(), this.posZ + Math.random()), new Vector3(0.0D, 0.0D, 0.0D), new Object[] {});
    GalacticraftCore.proxy.spawnParticle("distanceSmoke", new Vector3(this.posX - Math.random() / 2, this.posY + 1D + Math.random() / 2, this.posZ), new Vector3(0.0D, 0.0D, 0.0D), new Object[] {});
    GalacticraftCore.proxy.spawnParticle("distanceSmoke", new Vector3(this.posX, this.posY + 1D + Math.random(), this.posZ - Math.random()), new Vector3(0.0D, 0.0D, 0.0D), new Object[] {});
}
Also used : Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 27 with Vector3

use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.

the class ColorUtil method toVec3.

public static Vector3 toVec3(int col) {
    int gg = col >> 8;
    int rr = gg >> 8;
    gg &= 255;
    int bb = col & 255;
    return new Vector3(rr / 255F, gg / 255F, bb / 255F);
}
Also used : Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) TargetPoint(net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint)

Example 28 with Vector3

use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.

the class ColorUtil method rgb_to_hue.

private static double rgb_to_hue(Vector3 input) {
    double maxCol = Math.max(Math.max(input.x, input.y), input.z);
    if (maxCol <= 0) {
        return 0;
    }
    Vector3 rgb = input.scale(255D / maxCol);
    double mindist = 1024;
    int mini = 0;
    for (int i = 2; i < colorwheelAngles.length - 2; i++) {
        Vector3 color = colorwheelColors[i];
        double separation = color.distance(rgb);
        if (separation < mindist) {
            mindist = separation;
            mini = i;
        }
    }
    double separation1;
    double separation2;
    separation1 = colorwheelColors[mini - 1].distance(rgb);
    separation2 = colorwheelColors[mini + 1].distance(rgb);
    double hue;
    if (separation1 < separation2) {
        double separationtot = colorwheelColors[mini - 1].distance(colorwheelColors[mini]);
        hue = interpolateInArray(colorwheelAngles, mini, mindist / separationtot);
        if (hue < 0) {
            hue += 360D;
        }
    } else {
        double separationtot = colorwheelColors[mini + 1].distance(colorwheelColors[mini]);
        hue = interpolateInArray(colorwheelAngles, mini + 1, separation2 / separationtot);
        if (hue > 360D) {
            hue -= 360D;
        }
    }
    return hue;
}
Also used : Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) TargetPoint(net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint)

Example 29 with Vector3

use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.

the class EntityFXTeleport method onUpdate.

@Override
public void onUpdate() {
    TileEntityShortRangeTelepad telepad1 = this.telepad.get();
    if (telepad1 != null) {
        Vector3 color = telepad1.getParticleColor(this.rand, this.direction);
        this.particleRed = color.floatX();
        this.particleGreen = color.floatY();
        this.particleBlue = color.floatZ();
    }
    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;
    float f = (float) this.particleAge / (float) this.particleMaxAge;
    float f1 = f;
    f = -f + f * f * 2.0F;
    f = 1.0F - f;
    this.posX = this.portalPosX + this.motionX * f;
    this.posY = this.portalPosY + this.motionY * f + (1.0F - f1);
    this.posZ = this.portalPosZ + this.motionZ * f;
    if (this.particleAge++ >= this.particleMaxAge) {
        this.setDead();
    }
}
Also used : TileEntityShortRangeTelepad(micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityShortRangeTelepad) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 30 with Vector3

use of micdoodle8.mods.galacticraft.api.vector.Vector3 in project Galacticraft by micdoodle8.

the class BlockOxygenCollector method randomDisplayTick.

@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
    TileEntity tile = worldIn.getTileEntity(pos);
    if (tile instanceof TileEntityOxygenCollector) {
        if (((TileEntityOxygenCollector) tile).lastOxygenCollected > 1) {
            for (int particleCount = 0; particleCount < 10; particleCount++) {
                double x2 = pos.getX() + rand.nextFloat();
                double y2 = pos.getY() + rand.nextFloat();
                double z2 = pos.getZ() + rand.nextFloat();
                double mX = 0.0D;
                double mY = 0.0D;
                double mZ = 0.0D;
                int dir = rand.nextInt(2) * 2 - 1;
                mX = (rand.nextFloat() - 0.5D) * 0.5D;
                mY = (rand.nextFloat() - 0.5D) * 0.5D;
                mZ = (rand.nextFloat() - 0.5D) * 0.5D;
                final int meta = getMetaFromState(state);
                if (meta == 3 || meta == 2) {
                    x2 = pos.getX() + 0.5D + 0.25D * dir;
                    mX = rand.nextFloat() * 2.0F * dir;
                } else {
                    z2 = pos.getZ() + 0.5D + 0.25D * dir;
                    mZ = rand.nextFloat() * 2.0F * dir;
                }
                GalacticraftCore.proxy.spawnParticle("oxygen", new Vector3(x2, y2, z2), new Vector3(mX, mY, mZ), new Object[] { new Vector3(0.7D, 0.7D, 1.0D) });
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) TileEntityOxygenCollector(micdoodle8.mods.galacticraft.core.tile.TileEntityOxygenCollector) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)74 BlockPos (net.minecraft.util.BlockPos)13 Entity (net.minecraft.entity.Entity)12 TileEntity (net.minecraft.tileentity.TileEntity)11 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)8 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)8 EntityPlayer (net.minecraft.entity.player.EntityPlayer)8 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)6 IBlockState (net.minecraft.block.state.IBlockState)6 EntityLivingBase (net.minecraft.entity.EntityLivingBase)6 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)6 ItemStack (net.minecraft.item.ItemStack)6 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)5 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 WorldProviderSpaceStation (micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation)4 PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)4 FlagData (micdoodle8.mods.galacticraft.core.wrappers.FlagData)4 WorldServer (net.minecraft.world.WorldServer)4 GameProfile (com.mojang.authlib.GameProfile)3