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[] {});
}
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);
}
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;
}
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();
}
}
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) });
}
}
}
}
Aggregations