mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Immutabilize vector3 as it being defensively copied all over already
This commit is contained in:
28 files changed
+122
-209
No files matched your search
@@ -81,9 +81,9 @@ public final class RedStringRenderer {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(tile.getPos().getX() + 0.5 - renderPosX, tile.getPos().getY() + 0.5 - renderPosY, tile.getPos().getZ() + 0.5 - renderPosZ);
|
||||
Vector3 vecOrig = new Vector3(bind.getX() - tile.getPos().getX(), bind.getY() - tile.getPos().getY(), bind.getZ() - tile.getPos().getZ());
|
||||
Vector3 vecNorm = vecOrig.copy().normalize();
|
||||
Vector3 vecMag = vecNorm.copy().multiply(0.025);
|
||||
Vector3 vecApply = vecMag.copy();
|
||||
Vector3 vecNorm = vecOrig.normalize();
|
||||
Vector3 vecMag = vecNorm.multiply(0.025);
|
||||
Vector3 vecApply = vecMag;
|
||||
|
||||
int stages = (int) (vecOrig.mag() / vecMag.mag());
|
||||
|
||||
@@ -97,7 +97,7 @@ public final class RedStringRenderer {
|
||||
for(int i = 0; i < stages; i++) {
|
||||
addVertexAtWithTranslation(tessellator, dir, vecApply.x, vecApply.y, vecApply.z, rand, len);
|
||||
rand = Math.random() - 0.5;
|
||||
vecApply.add(vecMag);
|
||||
vecApply = vecApply.add(vecMag);
|
||||
len += add;
|
||||
addVertexAtWithTranslation(tessellator, dir, vecApply.x, vecApply.y, vecApply.z, rand, len);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class FXLightning extends Particle {
|
||||
this.speed = ticksPerMeter;
|
||||
this.colorOuter = colorOuter;
|
||||
this.colorInner = colorInner;
|
||||
this.length = targetvec.copy().subtract(sourcevec).mag();
|
||||
this.length = targetvec.subtract(sourcevec).mag();
|
||||
this.particleMaxAge = fadetime + rand.nextInt(fadetime) - fadetime / 2;
|
||||
this.particleAge = -(int) (length * speed);
|
||||
|
||||
@@ -86,8 +86,8 @@ public class FXLightning extends Particle {
|
||||
|
||||
double width = 0.025F * (playerVec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F;
|
||||
|
||||
Vector3 diff1 = playerVec.copy().crossProduct(rendersegment.prevDiff).normalize().multiply(width / rendersegment.sinPrev);
|
||||
Vector3 diff2 = playerVec.copy().crossProduct(rendersegment.nextDiff).normalize().multiply(width / rendersegment.sinNext);
|
||||
Vector3 diff1 = playerVec.crossProduct(rendersegment.prevDiff).normalize().multiply(width / rendersegment.sinPrev);
|
||||
Vector3 diff2 = playerVec.crossProduct(rendersegment.nextDiff).normalize().multiply(width / rendersegment.sinNext);
|
||||
|
||||
Vector3 startvec = rendersegment.startPoint.point;
|
||||
Vector3 endvec = rendersegment.endPoint.point;
|
||||
@@ -104,7 +104,7 @@ public class FXLightning extends Particle {
|
||||
wr.pos(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
|
||||
if(rendersegment.next == null) {
|
||||
Vector3 roundend = rendersegment.endPoint.point.copy().add(rendersegment.diff.copy().normalize().multiply(width));
|
||||
Vector3 roundend = rendersegment.endPoint.point.add(rendersegment.diff.normalize().multiply(width));
|
||||
|
||||
wr.pos(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
wr.pos(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
@@ -113,7 +113,7 @@ public class FXLightning extends Particle {
|
||||
}
|
||||
|
||||
if(rendersegment.prev == null) {
|
||||
Vector3 roundend = rendersegment.startPoint.point.copy().subtract(rendersegment.diff.copy().normalize().multiply(width));
|
||||
Vector3 roundend = rendersegment.startPoint.point.subtract(rendersegment.diff.normalize().multiply(width));
|
||||
|
||||
wr.pos(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
wr.pos(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
|
||||
@@ -132,7 +132,7 @@ public class FXLightning extends Particle {
|
||||
for(FXLightningSegment segment : oldSegments) {
|
||||
prev = segment.prev;
|
||||
|
||||
Vector3 subsegment = segment.diff.copy().multiply(1F / splits);
|
||||
Vector3 subsegment = segment.diff.multiply(1F / splits);
|
||||
|
||||
FXLightningBoltPoint[] newpoints = new FXLightningBoltPoint[splits + 1];
|
||||
|
||||
@@ -141,10 +141,10 @@ public class FXLightning extends Particle {
|
||||
newpoints[splits] = segment.endPoint;
|
||||
|
||||
for(int i = 1; i < splits; i++) {
|
||||
Vector3 randoff = segment.diff.copy().perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff);
|
||||
randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2);
|
||||
Vector3 randoff = segment.diff.perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff);
|
||||
randoff = randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2);
|
||||
|
||||
Vector3 basepoint = startpoint.copy().add(subsegment.copy().multiply(i));
|
||||
Vector3 basepoint = startpoint.add(subsegment.multiply(i));
|
||||
|
||||
newpoints[i] = new FXLightningBoltPoint(basepoint, randoff);
|
||||
}
|
||||
@@ -156,13 +156,13 @@ public class FXLightning extends Particle {
|
||||
prev.next = next;
|
||||
|
||||
if(i != 0 && rand.nextFloat() < splitChance) {
|
||||
Vector3 splitrot = next.diff.copy().xCrossProduct().rotate(rand.nextFloat() * 360, next.diff);
|
||||
Vector3 diff = next.diff.copy().rotate((rand.nextFloat() * 0.66F + 0.33F) * splitAngle, splitrot).multiply(splitLength);
|
||||
Vector3 splitrot = next.diff.xCrossProduct().rotate(rand.nextFloat() * 360, next.diff);
|
||||
Vector3 diff = next.diff.rotate((rand.nextFloat() * 0.66F + 0.33F) * splitAngle, splitrot).multiply(splitLength);
|
||||
|
||||
splitCount++;
|
||||
splitParents.put(splitCount, next.splitNo);
|
||||
|
||||
FXLightningSegment split = new FXLightningSegment(newpoints[i], new FXLightningBoltPoint(newpoints[i + 1].basepoint, newpoints[i + 1].offsetvec.copy().add(diff)), segment.light / 2F, next.segmentNo, splitCount);
|
||||
FXLightningSegment split = new FXLightningSegment(newpoints[i], new FXLightningBoltPoint(newpoints[i + 1].basepoint, newpoints[i + 1].offsetvec.add(diff)), segment.light / 2F, next.segmentNo, splitCount);
|
||||
split.prev = prev;
|
||||
|
||||
segments.add(split);
|
||||
|
||||
@@ -9,7 +9,7 @@ public class FXLightningBoltPoint {
|
||||
public final Vector3 offsetvec;
|
||||
|
||||
public FXLightningBoltPoint(Vector3 basepoint, Vector3 offsetvec) {
|
||||
point = basepoint.copy().add(offsetvec);
|
||||
point = basepoint.add(offsetvec);
|
||||
this.basepoint = basepoint;
|
||||
this.offsetvec = offsetvec;
|
||||
}
|
||||
|
||||
@@ -37,29 +37,29 @@ public class FXLightningSegment {
|
||||
}
|
||||
|
||||
public void calcDiff() {
|
||||
diff = endPoint.point.copy().subtract(startPoint.point);
|
||||
diff = endPoint.point.subtract(startPoint.point);
|
||||
}
|
||||
|
||||
public void calcEndDiffs() {
|
||||
if(prev != null) {
|
||||
Vector3 prevdiffnorm = prev.diff.copy().normalize();
|
||||
Vector3 thisdiffnorm = diff.copy().normalize();
|
||||
Vector3 prevdiffnorm = prev.diff.normalize();
|
||||
Vector3 thisdiffnorm = diff.normalize();
|
||||
|
||||
prevDiff = thisdiffnorm.copy().add(prevdiffnorm).normalize();
|
||||
prevDiff = thisdiffnorm.add(prevdiffnorm).normalize();
|
||||
sinPrev = (float) Math.sin(thisdiffnorm.angle(prevdiffnorm.multiply(-1)) / 2);
|
||||
} else {
|
||||
prevDiff = diff.copy().normalize();
|
||||
prevDiff = diff.normalize();
|
||||
sinPrev = 1;
|
||||
}
|
||||
|
||||
if(next != null) {
|
||||
Vector3 nextdiffnorm = next.diff.copy().normalize();
|
||||
Vector3 thisdiffnorm = diff.copy().normalize();
|
||||
Vector3 nextdiffnorm = next.diff.normalize();
|
||||
Vector3 thisdiffnorm = diff.normalize();
|
||||
|
||||
nextDiff = thisdiffnorm.add(nextdiffnorm).normalize();
|
||||
sinNext = (float) Math.sin(thisdiffnorm.angle(nextdiffnorm.multiply(-1)) / 2);
|
||||
} else {
|
||||
nextDiff = diff.copy().normalize();
|
||||
nextDiff = diff.normalize();
|
||||
sinNext = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
|
||||
int colorDark = new Color(color).darker().getRGB();
|
||||
|
||||
Vector3 origVector = new Vector3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||
Vector3 endVector = origVector.copy().add(world.rand.nextDouble() * 2 - 1, world.rand.nextDouble() * 2 - 1, world.rand.nextDouble() * 2 - 1);
|
||||
Vector3 endVector = origVector.add(world.rand.nextDouble() * 2 - 1, world.rand.nextDouble() * 2 - 1, world.rand.nextDouble() * 2 - 1);
|
||||
Botania.proxy.lightningFX(world, origVector, endVector, 5F, colorDark, colorBright);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ public class TileLightRelay extends TileMod implements IWandBindable {
|
||||
int count = 10;
|
||||
int start = ticksElapsed % size;
|
||||
|
||||
Vector3 vecMag = vec.copy().normalize().multiply(dist);
|
||||
Vector3 vecTip = vecMag.copy().multiply(start).add(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||
Vector3 vecMag = vec.normalize().multiply(dist);
|
||||
Vector3 vecTip = vecMag.multiply(start).add(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
|
||||
|
||||
double radPer = Math.PI / 16.0;
|
||||
float mul = 0.5F;
|
||||
@@ -88,9 +88,9 @@ public class TileLightRelay extends TileMod implements IWandBindable {
|
||||
for(int i = start; i < start + count; i++) {
|
||||
mul = Math.min(maxMul, mul + mulPer);
|
||||
double rad = radPer * (i + ticksElapsed * 0.4);
|
||||
Vector3 vecRot = vecMag.copy().crossProduct(Vector3.one).multiply(mul).rotate(rad, vecMag).add(vecTip);
|
||||
Vector3 vecRot = vecMag.crossProduct(Vector3.ONE).multiply(mul).rotate(rad, vecMag).add(vecTip);
|
||||
Botania.proxy.wispFX(worldObj, vecRot.x, vecRot.y, vecRot.z, 0.4F, 0.4F, 1F, 0.1F, (float) -vecMag.x, (float) -vecMag.y, (float) -vecMag.z, 1F);
|
||||
vecTip.add(vecMag);
|
||||
vecTip = vecTip.add(vecMag);
|
||||
}
|
||||
|
||||
BlockPos endpoint = getEndpoint();
|
||||
|
||||
@@ -58,8 +58,8 @@ public class TilePylon extends TileEntity implements ITickable {
|
||||
double z = pos.getZ() + 0.5 + Math.sin(worldTime) * r;
|
||||
|
||||
Vector3 ourCoords = new Vector3(x, pos.getY() + 0.25, z);
|
||||
centerBlock.sub(new Vector3(0, 0.5, 0));
|
||||
Vector3 movementVector = centerBlock.sub(ourCoords).normalize().multiply(0.2);
|
||||
centerBlock = centerBlock.subtract(new Vector3(0, 0.5, 0));
|
||||
Vector3 movementVector = centerBlock.subtract(ourCoords).normalize().multiply(0.2);
|
||||
|
||||
Botania.proxy.wispFX(worldObj, x, pos.getY() + 0.25, z, (float) Math.random() * 0.25F, 0.75F + (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, 0.25F + (float) Math.random() * 0.1F, -0.075F - (float) Math.random() * 0.015F);
|
||||
if(worldObj.rand.nextInt(3) == 0)
|
||||
@@ -67,7 +67,7 @@ public class TilePylon extends TileEntity implements ITickable {
|
||||
}
|
||||
} else {
|
||||
Vector3 ourCoords = Vector3.fromTileEntityCenter(this).add(0, 1 + (Math.random() - 0.5 * 0.25), 0);
|
||||
Vector3 movementVector = centerBlock.sub(ourCoords).normalize().multiply(0.2);
|
||||
Vector3 movementVector = centerBlock.subtract(ourCoords).normalize().multiply(0.2);
|
||||
|
||||
Block block = worldObj.getBlockState(pos.down()).getBlock();
|
||||
if(block == ModBlocks.flower || block == ModBlocks.shinyFlower) {
|
||||
|
||||
@@ -120,7 +120,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
|
||||
if(worldObj.isRemote && manaToGet > 0 && mana >= manaToGet) {
|
||||
if(worldObj.rand.nextInt(20) == 0) {
|
||||
Vector3 vec = Vector3.fromTileEntityCenter(this);
|
||||
Vector3 endVec = vec.copy().add(0, 2.5, 0);
|
||||
Vector3 endVec = vec.add(0, 2.5, 0);
|
||||
Botania.proxy.lightningFX(worldObj, vec, endVec, 2F, 0x00948B, 0x00E4D7);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,7 +690,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
if(!blockVec.isInside(axis))
|
||||
blockVec = new Vector3(axis.minX + (axis.maxX - axis.minX) / 2, axis.minY + (axis.maxY - axis.minY) / 2, axis.minZ + (axis.maxZ - axis.minZ) / 2);
|
||||
|
||||
Vector3 diffVec = blockVec.copy().sub(thisVec);
|
||||
Vector3 diffVec = blockVec.subtract(thisVec);
|
||||
Vector3 diffVec2D = new Vector3(diffVec.x, diffVec.z, 0);
|
||||
Vector3 rotVec = new Vector3(0, 1, 0);
|
||||
double angle = rotVec.angle(diffVec2D) / Math.PI * 180.0;
|
||||
|
||||
@@ -50,10 +50,10 @@ public final class MathHelper {
|
||||
|
||||
public static void setEntityMotionFromVector(Entity entity, Vector3 originalPosVector, float modifier) {
|
||||
Vector3 entityVector = Vector3.fromEntityCenter(entity);
|
||||
Vector3 finalVector = originalPosVector.copy().subtract(entityVector);
|
||||
Vector3 finalVector = originalPosVector.subtract(entityVector);
|
||||
|
||||
if(finalVector.mag() > 1)
|
||||
finalVector.normalize();
|
||||
finalVector = finalVector.normalize();
|
||||
|
||||
entity.motionX = finalVector.x * modifier;
|
||||
entity.motionY = finalVector.y * modifier;
|
||||
|
||||
@@ -68,14 +68,17 @@ public final class Quat {
|
||||
}
|
||||
}
|
||||
|
||||
public void rotate(Vector3 vec) {
|
||||
public Vector3 rotate(Vector3 vec) {
|
||||
double d = -x * vec.x - y * vec.y - z * vec.z;
|
||||
double d1 = s * vec.x + y * vec.z - z * vec.y;
|
||||
double d2 = s * vec.y - x * vec.z + z * vec.x;
|
||||
double d3 = s * vec.z + x * vec.y - y * vec.x;
|
||||
vec.x = d1 * s - d * x - d2 * z + d3 * y;
|
||||
vec.y = d2 * s - d * y + d1 * z - d3 * x;
|
||||
vec.z = d3 * s - d * z - d1 * y + d2 * x;
|
||||
|
||||
double vx = d1 * s - d * x - d2 * z + d3 * y;
|
||||
double vy = d2 * s - d * y + d1 * z - d3 * x;
|
||||
double vz = d3 * s - d * z - d1 * y + d2 * x;
|
||||
|
||||
return new Vector3(vx, vy, vz);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,20 +24,18 @@ import org.lwjgl.util.vector.Vector4f;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Vector3
|
||||
{
|
||||
public static final Vector3 zero = new Vector3();
|
||||
public static final Vector3 one = new Vector3(1, 1, 1);
|
||||
public static final Vector3 center = new Vector3(0.5, 0.5, 0.5);
|
||||
public static final Vector3 ZERO = new Vector3(0, 0, 0);
|
||||
public static final Vector3 ONE = new Vector3(1, 1, 1);
|
||||
public static final Vector3 CENTER = new Vector3(0.5, 0.5, 0.5);
|
||||
|
||||
public double x;
|
||||
public double y;
|
||||
public double z;
|
||||
|
||||
public Vector3() {
|
||||
}
|
||||
public final double x;
|
||||
public final double y;
|
||||
public final double z;
|
||||
|
||||
public Vector3(double d, double d1, double d2) {
|
||||
x = d;
|
||||
@@ -45,20 +43,8 @@ public class Vector3
|
||||
z = d2;
|
||||
}
|
||||
|
||||
public Vector3(Vector3 vec) {
|
||||
x = vec.x;
|
||||
y = vec.y;
|
||||
z = vec.z;
|
||||
}
|
||||
|
||||
public Vector3(Vec3d vec) {
|
||||
x = vec.xCoord;
|
||||
y = vec.yCoord;
|
||||
z = vec.zCoord;
|
||||
}
|
||||
|
||||
public Vector3 copy() {
|
||||
return new Vector3(this);
|
||||
this(vec.xCoord, vec.yCoord, vec.zCoord);
|
||||
}
|
||||
|
||||
public static Vector3 fromBlockPos(BlockPos pos) {
|
||||
@@ -81,20 +67,6 @@ public class Vector3
|
||||
return fromTileEntity(e).add(0.5);
|
||||
}
|
||||
|
||||
public Vector3 set(double d, double d1, double d2) {
|
||||
x = d;
|
||||
y = d1;
|
||||
z = d2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector3 set(Vector3 vec) {
|
||||
x = vec.x;
|
||||
y = vec.y;
|
||||
z = vec.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public double dotProduct(Vector3 vec) {
|
||||
double d = vec.x * x + vec.y * y + vec.z * z;
|
||||
|
||||
@@ -113,67 +85,35 @@ public class Vector3
|
||||
double d = y * vec.z - z * vec.y;
|
||||
double d1 = z * vec.x - x * vec.z;
|
||||
double d2 = x * vec.y - y * vec.x;
|
||||
x = d;
|
||||
y = d1;
|
||||
z = d2;
|
||||
return this;
|
||||
return new Vector3(d, d1, d2);
|
||||
}
|
||||
|
||||
public Vector3 add(double d, double d1, double d2) {
|
||||
x += d;
|
||||
y += d1;
|
||||
z += d2;
|
||||
return this;
|
||||
return new Vector3(x + d, y + d1, z + d2);
|
||||
}
|
||||
|
||||
public Vector3 add(Vector3 vec) {
|
||||
x += vec.x;
|
||||
y += vec.y;
|
||||
z += vec.z;
|
||||
return this;
|
||||
return add(vec.x, vec.y, vec.z);
|
||||
}
|
||||
|
||||
public Vector3 add(double d) {
|
||||
return add(d, d, d);
|
||||
}
|
||||
|
||||
public Vector3 sub(Vector3 vec) {
|
||||
return subtract(vec);
|
||||
}
|
||||
|
||||
public Vector3 subtract(Vector3 vec) {
|
||||
x -= vec.x;
|
||||
y -= vec.y;
|
||||
z -= vec.z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vector3 negate(Vector3 vec) {
|
||||
x = -x;
|
||||
y = -y;
|
||||
z = -z;
|
||||
return this;
|
||||
return new Vector3(x - vec.x, y - vec.y, z - vec.z);
|
||||
}
|
||||
|
||||
public Vector3 multiply(double d) {
|
||||
x *= d;
|
||||
y *= d;
|
||||
z *= d;
|
||||
return this;
|
||||
return multiply(d, d, d);
|
||||
}
|
||||
|
||||
public Vector3 multiply(Vector3 f) {
|
||||
x *= f.x;
|
||||
y *= f.y;
|
||||
z *= f.z;
|
||||
return this;
|
||||
return multiply(f.x, f.y, f.z);
|
||||
}
|
||||
|
||||
public Vector3 multiply(double fx, double fy, double fz) {
|
||||
x *= fx;
|
||||
y *= fy;
|
||||
z *= fz;
|
||||
return this;
|
||||
return new Vector3(x * fx, y * fy, z * fz);
|
||||
}
|
||||
|
||||
public double mag() {
|
||||
@@ -187,7 +127,7 @@ public class Vector3
|
||||
public Vector3 normalize() {
|
||||
double d = mag();
|
||||
if(d != 0)
|
||||
multiply(1 / d);
|
||||
return multiply(1 / d);
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -207,29 +147,19 @@ public class Vector3
|
||||
public Vector3 xCrossProduct() {
|
||||
double d = z;
|
||||
double d1 = -y;
|
||||
x = 0;
|
||||
y = d;
|
||||
z = d1;
|
||||
return this;
|
||||
return new Vector3(0, d, d1);
|
||||
}
|
||||
|
||||
public Vector3 zCrossProduct() {
|
||||
double d = y;
|
||||
|
||||
double d1 = -x;
|
||||
x = d;
|
||||
y = d1;
|
||||
z = 0;
|
||||
return this;
|
||||
return new Vector3(d, d1, 0);
|
||||
}
|
||||
|
||||
public Vector3 yCrossProduct() {
|
||||
double d = -z;
|
||||
double d1 = x;
|
||||
x = d;
|
||||
y = 0;
|
||||
z = d1;
|
||||
return this;
|
||||
return new Vector3(d, 0, d1);
|
||||
}
|
||||
|
||||
public Vec3d toVec3D() {
|
||||
@@ -237,7 +167,7 @@ public class Vector3
|
||||
}
|
||||
|
||||
public double angle(Vector3 vec) {
|
||||
return Math.acos(copy().normalize().dotProduct(vec.copy().normalize()));
|
||||
return Math.acos(normalize().dotProduct(vec.normalize()));
|
||||
}
|
||||
|
||||
public boolean isInside(AxisAlignedBB aabb) {
|
||||
@@ -266,10 +196,7 @@ public class Vector3
|
||||
}
|
||||
|
||||
public Vector3 negate() {
|
||||
x = -x;
|
||||
y = -y;
|
||||
z = -z;
|
||||
return this;
|
||||
return new Vector3(-x, -y, -z);
|
||||
}
|
||||
|
||||
public double scalarProject(Vector3 b) {
|
||||
@@ -280,18 +207,15 @@ public class Vector3
|
||||
public Vector3 project(Vector3 b) {
|
||||
double l = b.magSquared();
|
||||
if(l == 0) {
|
||||
set(0, 0, 0);
|
||||
return this;
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
double m = dotProduct(b)/l;
|
||||
set(b).multiply(m);
|
||||
return this;
|
||||
return b.multiply(m);
|
||||
}
|
||||
|
||||
public Vector3 rotate(double angle, Vector3 axis) {
|
||||
Quat.aroundAxis(axis.copy().normalize(), angle).rotate(this);
|
||||
return this;
|
||||
return Quat.aroundAxis(axis.normalize(), angle).rotate(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -119,7 +119,7 @@ public class EntityBabylonWeapon extends EntityThrowableCopy {
|
||||
else playerLook = new Vector3(lookat.getBlockPos().getX() + 0.5, lookat.getBlockPos().getY() + 0.5, lookat.getBlockPos().getZ() + 0.5);
|
||||
|
||||
Vector3 thisVec = Vector3.fromEntityCenter(this);
|
||||
Vector3 motionVec = playerLook.sub(thisVec).normalize().multiply(2);
|
||||
Vector3 motionVec = playerLook.subtract(thisVec).normalize().multiply(2);
|
||||
|
||||
x = motionVec.x;
|
||||
y = motionVec.y;
|
||||
|
||||
@@ -86,7 +86,6 @@ import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -399,7 +398,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBoss {
|
||||
if(attacker != null) {
|
||||
Vector3 thisVector = Vector3.fromEntityCenter(this);
|
||||
Vector3 playerVector = Vector3.fromEntityCenter(attacker);
|
||||
Vector3 motionVector = thisVector.copy().sub(playerVector).copy().normalize().multiply(0.75);
|
||||
Vector3 motionVector = thisVector.subtract(playerVector).normalize().multiply(0.75);
|
||||
|
||||
if(getHealth() > 0) {
|
||||
motionX = -motionVector.x;
|
||||
@@ -536,7 +535,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBoss {
|
||||
double zp = pylonPos.z + 0.5 + Math.sin(worldTime) * rad;
|
||||
|
||||
Vector3 partPos = new Vector3(xp, pylonPos.y, zp);
|
||||
Vector3 mot = pos.copy().sub(partPos).multiply(0.04);
|
||||
Vector3 mot = pos.subtract(partPos).multiply(0.04);
|
||||
|
||||
float r = 0.7F + (float) Math.random() * 0.3F;
|
||||
float g = (float) Math.random() * 0.3F;
|
||||
@@ -600,7 +599,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBoss {
|
||||
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5) >= range) {
|
||||
Vector3 sourceVector = new Vector3(source.getX() + 0.5, source.getY() + 0.5, source.getZ() + 0.5);
|
||||
Vector3 playerVector = Vector3.fromEntityCenter(player);
|
||||
Vector3 motion = sourceVector.copy().sub(playerVector).copy().normalize();
|
||||
Vector3 motion = sourceVector.subtract(playerVector).normalize();
|
||||
|
||||
player.motionX = motion.x;
|
||||
player.motionY = 0.2;
|
||||
|
||||
@@ -98,10 +98,10 @@ public class EntityMagicMissile extends EntityThrowable {
|
||||
boolean evil = isEvil();
|
||||
Vector3 thisVec = Vector3.fromEntityCenter(this);
|
||||
Vector3 oldPos = new Vector3(lastTickPosX, lastTickPosY, lastTickPosZ);
|
||||
Vector3 diff = thisVec.copy().sub(oldPos);
|
||||
Vector3 step = diff.copy().normalize().multiply(0.05);
|
||||
Vector3 diff = thisVec.subtract(oldPos);
|
||||
Vector3 step = diff.normalize().multiply(0.05);
|
||||
int steps = (int) (diff.mag() / step.mag());
|
||||
Vector3 particlePos = oldPos.copy();
|
||||
Vector3 particlePos = oldPos;
|
||||
|
||||
Botania.proxy.setSparkleFXCorrupt(evil);
|
||||
for(int i = 0; i < steps; i++) {
|
||||
@@ -109,7 +109,7 @@ public class EntityMagicMissile extends EntityThrowable {
|
||||
if(worldObj.rand.nextInt(steps) <= 1)
|
||||
Botania.proxy.sparkleFX(worldObj, particlePos.x + (Math.random() - 0.5) * 0.4, particlePos.y + (Math.random() - 0.5) * 0.4, particlePos.z + (Math.random() - 0.5) * 0.4, 1F, evil ? 0F : 0.4F, 1F, 0.8F, 2);
|
||||
|
||||
particlePos.add(step);
|
||||
particlePos = particlePos.add(step);
|
||||
}
|
||||
Botania.proxy.setSparkleFXCorrupt(false);
|
||||
|
||||
@@ -122,8 +122,8 @@ public class EntityMagicMissile extends EntityThrowable {
|
||||
}
|
||||
|
||||
Vector3 targetVec = evil ? new Vector3(lockX, lockY, lockZ) : Vector3.fromEntityCenter(target);
|
||||
Vector3 diffVec = targetVec.copy().sub(thisVec);
|
||||
Vector3 motionVec = diffVec.copy().normalize().multiply(evil ? 0.5 : 0.6);
|
||||
Vector3 diffVec = targetVec.subtract(thisVec);
|
||||
Vector3 motionVec = diffVec.normalize().multiply(evil ? 0.5 : 0.6);
|
||||
motionX = motionVec.x;
|
||||
motionY = motionVec.y;
|
||||
if(time < 10)
|
||||
|
||||
@@ -339,8 +339,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
|
||||
Vector3 currentPos = Vector3.fromEntity(this);
|
||||
Vector3 oldPos = new Vector3(prevPosX, prevPosY, prevPosZ);
|
||||
Vector3 diffVec = oldPos.copy().sub(currentPos);
|
||||
Vector3 diffVecNorm = diffVec.copy().normalize();
|
||||
Vector3 diffVec = oldPos.subtract(currentPos);
|
||||
Vector3 diffVecNorm = diffVec.normalize();
|
||||
|
||||
double distance = 0.095;
|
||||
|
||||
@@ -358,7 +358,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
posZ += diffVecNorm.z * distance;
|
||||
|
||||
currentPos = Vector3.fromEntity(this);
|
||||
diffVec = oldPos.copy().sub(currentPos);
|
||||
diffVec = oldPos.subtract(currentPos);
|
||||
if(getEntityData().hasKey(ItemTinyPlanet.TAG_ORBIT))
|
||||
break;
|
||||
} while(Math.abs(diffVec.mag()) > distance);
|
||||
|
||||
@@ -30,7 +30,6 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
@@ -83,7 +82,7 @@ public class EntityThornChakram extends EntityThrowable {
|
||||
// Returning motion
|
||||
if(isReturning()) {
|
||||
Entity thrower = worldObj.getEntityByID(getEntityToReturnTo());
|
||||
Vector3 motion = Vector3.fromEntityCenter(thrower).sub(Vector3.fromEntityCenter(this)).normalize();
|
||||
Vector3 motion = Vector3.fromEntityCenter(thrower).subtract(Vector3.fromEntityCenter(this)).normalize();
|
||||
motionX = motion.x;
|
||||
motionY = motion.y;
|
||||
motionZ = motion.z;
|
||||
|
||||
@@ -131,13 +131,14 @@ public class ItemSextant extends ItemMod {
|
||||
Botania.proxy.wispFX(world, source.x + 0.5, source.y + 1, source.z + 0.5, 1F, 0F, 0F, 0.2F, -0.1F);
|
||||
|
||||
Vector3 centerVec = Vector3.fromEntityCenter(player);
|
||||
Vector3 diffVec = source.copy().subtract(centerVec);
|
||||
Vector3 diffVec = source.subtract(centerVec);
|
||||
Vector3 lookVec = new Vector3(player.getLookVec());
|
||||
double mul = diffVec.y / lookVec.y;
|
||||
lookVec.multiply(mul).add(centerVec);
|
||||
lookVec = lookVec.multiply(mul).add(centerVec);
|
||||
|
||||
lookVec.x = net.minecraft.util.math.MathHelper.floor_double(lookVec.x);
|
||||
lookVec.z = net.minecraft.util.math.MathHelper.floor_double(lookVec.z);
|
||||
lookVec = new Vector3(net.minecraft.util.math.MathHelper.floor_double(lookVec.x),
|
||||
lookVec.y,
|
||||
net.minecraft.util.math.MathHelper.floor_double(lookVec.z));
|
||||
|
||||
return MathHelper.pointDistancePlane(source.x, source.z, lookVec.x, lookVec.z);
|
||||
}
|
||||
|
||||
@@ -169,13 +169,13 @@ public class ItemTwigWand extends Item16Colors implements ICoordBoundItem {
|
||||
if(!world.isRemote)
|
||||
return;
|
||||
|
||||
Vector3 diff = end.copy().sub(orig);
|
||||
Vector3 movement = diff.copy().normalize().multiply(0.05);
|
||||
Vector3 diff = end.subtract(orig);
|
||||
Vector3 movement = diff.normalize().multiply(0.05);
|
||||
int iters = (int) (diff.mag() / movement.mag());
|
||||
float huePer = 1F / iters;
|
||||
float hueSum = (float) Math.random();
|
||||
|
||||
Vector3 currentPos = orig.copy();
|
||||
Vector3 currentPos = orig;
|
||||
for(int i = 0; i < iters; i++) {
|
||||
float hue = i * huePer + hueSum;
|
||||
Color color = Color.getHSBColor(hue, 1F, 1F);
|
||||
@@ -186,7 +186,7 @@ public class ItemTwigWand extends Item16Colors implements ICoordBoundItem {
|
||||
Botania.proxy.setSparkleFXNoClip(true);
|
||||
Botania.proxy.sparkleFX(world, currentPos.x, currentPos.y, currentPos.z, r, g, b, 0.5F, 4);
|
||||
Botania.proxy.setSparkleFXNoClip(false);
|
||||
currentPos.add(movement);
|
||||
currentPos = currentPos.add(movement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,9 +164,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
|
||||
|
||||
int time = ItemNBTHelper.getInt(stack, TAG_TIME_LEFT, MAX_FLY_TIME);
|
||||
int newTime = time;
|
||||
Vector3 look = new Vector3(p.getLookVec());
|
||||
look.y = 0;
|
||||
look.normalize();
|
||||
Vector3 look = new Vector3(p.getLookVec()).multiply(1, 0, 1).normalize();
|
||||
|
||||
if(flying) {
|
||||
if(time > 0 && !ItemNBTHelper.getBoolean(stack, TAG_INFINITE_FLIGHT, false))
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ItemTinyPlanet extends ItemBauble implements IBaubleRender {
|
||||
|
||||
Vector3 targetVec = new Vector3(xTarget, yTarget, zTarget);
|
||||
Vector3 currentVec = new Vector3(entity.posX, entity.posY, entity.posZ);
|
||||
Vector3 moveVector = targetVec.copy().sub(currentVec);
|
||||
Vector3 moveVector = targetVec.subtract(currentVec);
|
||||
|
||||
burst.setMotion(moveVector.x, moveVector.y, moveVector.z);
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ public class ItemStarSword extends ItemManasteelSword implements ICraftAchieveme
|
||||
if(player.getHeldItemMainhand() == par1ItemStack && player.swingProgress == check && !world.isRemote) {
|
||||
RayTraceResult pos = ToolCommons.raytraceFromEntity(world, par3Entity, true, 48);
|
||||
if(pos != null && pos.getBlockPos() != null) {
|
||||
Vector3 posVec = new Vector3(pos.getBlockPos().getX(), pos.getBlockPos().getY(), pos.getBlockPos().getZ());
|
||||
Vector3 posVec = Vector3.fromBlockPos(pos.getBlockPos());
|
||||
Vector3 motVec = new Vector3((0.5 * Math.random() - 0.25) * 18, 24, (0.5 * Math.random() - 0.25) * 18);
|
||||
posVec.add(motVec);
|
||||
posVec = posVec.add(motVec);
|
||||
motVec.normalize().negate().multiply(1.5);
|
||||
|
||||
EntityFallingStar star = new EntityFallingStar(world, player);
|
||||
|
||||
@@ -54,13 +54,13 @@ public class LensMagnet extends Lens {
|
||||
Vector3 tileVec = Vector3.fromTileEntityCenter(tile).add(0, -0.1, 0);
|
||||
Vector3 motionVec = new Vector3(entity.motionX, entity.motionY, entity.motionZ);
|
||||
|
||||
Vector3 normalMotionVec = motionVec.copy().normalize();
|
||||
Vector3 magnetVec = tileVec.sub(burstVec).normalize();
|
||||
Vector3 differenceVec = normalMotionVec.sub(magnetVec).multiply(motionVec.mag() * 0.1);
|
||||
Vector3 normalMotionVec = motionVec.normalize();
|
||||
Vector3 magnetVec = tileVec.subtract(burstVec).normalize();
|
||||
Vector3 differenceVec = normalMotionVec.subtract(magnetVec).multiply(motionVec.mag() * 0.1);
|
||||
|
||||
Vector3 finalMotionVec = motionVec.sub(differenceVec);
|
||||
Vector3 finalMotionVec = motionVec.subtract(differenceVec);
|
||||
if(!magnetized) {
|
||||
finalMotionVec.multiply(0.75);
|
||||
finalMotionVec = finalMotionVec.multiply(0.75);
|
||||
entity.getEntityData().setBoolean(TAG_MAGNETIZED, true);
|
||||
entity.getEntityData().setInteger(TAG_MAGNETIZED_X, tile.getPos().getX());
|
||||
entity.getEntityData().setInteger(TAG_MAGNETIZED_Y, tile.getPos().getY());
|
||||
|
||||
@@ -41,7 +41,7 @@ public class LensRedirect extends Lens {
|
||||
if(!sourceVec.isInside(axis))
|
||||
sourceVec = new Vector3(axis.minX + (axis.maxX - axis.minX) / 2, axis.minY + (axis.maxY - axis.minY) / 2, axis.minZ + (axis.maxZ - axis.minZ) / 2);
|
||||
|
||||
Vector3 diffVec = sourceVec.copy().sub(tileVec);
|
||||
Vector3 diffVec = sourceVec.subtract(tileVec);
|
||||
Vector3 diffVec2D = new Vector3(diffVec.x, diffVec.z, 0);
|
||||
Vector3 rotVec = new Vector3(0, 1, 0);
|
||||
double angle = rotVec.angle(diffVec2D) / Math.PI * 180.0;
|
||||
|
||||
@@ -63,25 +63,23 @@ public class ItemKingKey extends ItemRelic implements IManaUsingItem {
|
||||
int spawned = getWeaponsSpawned(stack);
|
||||
|
||||
if(count != getMaxItemUseDuration(stack) && spawned < 20 && !living.worldObj.isRemote && (!(living instanceof EntityPlayer) || ManaItemHandler.requestManaExact(stack, ((EntityPlayer) living), 150, true))) {
|
||||
Vector3 look = new Vector3(living.getLookVec());
|
||||
look.y = 0;
|
||||
look.normalize().negate().multiply(2);
|
||||
Vector3 look = new Vector3(living.getLookVec()).multiply(1, 0, 1).normalize().negate().multiply(2);
|
||||
int div = spawned / 5;
|
||||
int mod = spawned % 5;
|
||||
|
||||
Vector3 pl = look.copy().add(Vector3.fromEntityCenter(living)).add(0, 1.6, div * 0.1);
|
||||
Vector3 pl = look.add(Vector3.fromEntityCenter(living)).add(0, 1.6, div * 0.1);
|
||||
|
||||
Random rand = living.worldObj.rand;
|
||||
Vector3 axis = look.copy().normalize().crossProduct(new Vector3(-1, 0, -1)).normalize();
|
||||
Vector3 axis1 = axis.copy();
|
||||
Vector3 axis = look.normalize().crossProduct(new Vector3(-1, 0, -1)).normalize();
|
||||
Vector3 axis1 = axis;
|
||||
|
||||
double rot = mod * Math.PI / 4 - Math.PI / 2;
|
||||
|
||||
axis1.multiply(div * 3.5 + 5).rotate(rot, look);
|
||||
axis1 = axis1.multiply(div * 3.5 + 5).rotate(rot, look);
|
||||
if(axis1.y < 0)
|
||||
axis1.y = -axis1.y;
|
||||
axis1 = axis.multiply(0, -1, 0);
|
||||
|
||||
Vector3 end = pl.copy().add(axis1);
|
||||
Vector3 end = pl.add(axis1);
|
||||
|
||||
EntityBabylonWeapon weapon = new EntityBabylonWeapon(living.worldObj, living);
|
||||
weapon.posX = end.x;
|
||||
|
||||
@@ -103,9 +103,7 @@ public class ItemGravityRod extends ItemMod implements IManaUsingItem {
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
int distance = 1;
|
||||
while(entities.size() == 0 && distance < 25) {
|
||||
target.add(new Vector3(player.getLookVec()).multiply(distance));
|
||||
|
||||
target.y += 0.5;
|
||||
target = target.add(new Vector3(player.getLookVec()).multiply(distance)).add(0, 0.5, 0);
|
||||
entities = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, new AxisAlignedBB(target.x - RANGE, target.y - RANGE, target.z - RANGE, target.x + RANGE, target.y + RANGE, target.z + RANGE));
|
||||
distance++;
|
||||
if(entities.contains(taritem))
|
||||
@@ -121,9 +119,7 @@ public class ItemGravityRod extends ItemMod implements IManaUsingItem {
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
int distance = 1;
|
||||
while(entities.size() == 0 && distance < 25) {
|
||||
target.add(new Vector3(player.getLookVec()).multiply(distance));
|
||||
|
||||
target.y += 0.5;
|
||||
target = target.add(new Vector3(player.getLookVec()).multiply(distance)).add(0, 0.5, 0);
|
||||
entities = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, new AxisAlignedBB(target.x - RANGE, target.y - RANGE, target.z - RANGE, target.x + RANGE, target.y + RANGE, target.z + RANGE));
|
||||
distance++;
|
||||
}
|
||||
@@ -151,11 +147,10 @@ public class ItemGravityRod extends ItemMod implements IManaUsingItem {
|
||||
targetEntity.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 2, 3, true, true));
|
||||
}
|
||||
|
||||
Vector3 target3 = Vector3.fromEntityCenter(player);
|
||||
target3.add(new Vector3(player.getLookVec()).multiply(length));
|
||||
target3.y += 0.5;
|
||||
Vector3 target3 = Vector3.fromEntityCenter(player)
|
||||
.add(new Vector3(player.getLookVec()).multiply(length)).add(0, 0.5, 0);
|
||||
if(item instanceof EntityItem)
|
||||
target3.y += 0.25;
|
||||
target3 = target3.add(0, 0.25, 0);
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
float r = 0.5F + (float) Math.random() * 0.5F;
|
||||
@@ -201,9 +196,7 @@ public class ItemGravityRod extends ItemMod implements IManaUsingItem {
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
int distance = 1;
|
||||
while(entities.size() == 0 && distance < 25) {
|
||||
target.add(new Vector3(player.getLookVec()).multiply(distance));
|
||||
|
||||
target.y += 0.5;
|
||||
target = target.add(new Vector3(player.getLookVec()).multiply(distance)).add(0, 0.5, 0);
|
||||
entities = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, new AxisAlignedBB(target.x - RANGE, target.y - RANGE, target.z - RANGE, target.x + RANGE, target.y + RANGE, target.z + RANGE));
|
||||
distance++;
|
||||
if(entities.contains(taritem))
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ItemSkyDirtRod extends ItemDirtRod {
|
||||
if(!world.isRemote && ManaItemHandler.requestManaExactForTool(stack, player, COST * 2, false)) {
|
||||
Vector3 playerVec = Vector3.fromEntityCenter(player);
|
||||
Vector3 lookVec = new Vector3(player.getLookVec()).multiply(3);
|
||||
Vector3 placeVec = playerVec.copy().add(lookVec);
|
||||
Vector3 placeVec = playerVec.add(lookVec);
|
||||
|
||||
int x = MathHelper.floor_double(placeVec.x);
|
||||
int y = MathHelper.floor_double(placeVec.y) + 1;
|
||||
|
||||
@@ -11,7 +11,6 @@ import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import vazkii.botania.client.core.handler.LightningHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
@@ -148,13 +147,13 @@ public class PacketBotaniaEffect implements IMessage {
|
||||
|
||||
Vector3 orig = new Vector3(e1.posX , e1.posY + 0.25, e1.posZ);
|
||||
Vector3 end = new Vector3(e2.posX, e2.posY + 0.25, e2.posZ);
|
||||
Vector3 diff = end.copy().sub(orig);
|
||||
Vector3 movement = diff.copy().normalize().multiply(0.1);
|
||||
Vector3 diff = end.subtract(orig);
|
||||
Vector3 movement = diff.normalize().multiply(0.1);
|
||||
int iters = (int) (diff.mag() / movement.mag());
|
||||
float huePer = 1F / iters;
|
||||
float hueSum = (float) Math.random();
|
||||
|
||||
Vector3 currentPos = orig.copy();
|
||||
Vector3 currentPos = orig;
|
||||
for(int i = 0; i < iters; i++) {
|
||||
float hue = i * huePer + hueSum;
|
||||
Color color = Color.getHSBColor(hue, 1F, 1F);
|
||||
@@ -165,7 +164,7 @@ public class PacketBotaniaEffect implements IMessage {
|
||||
Botania.proxy.setSparkleFXNoClip(true);
|
||||
Botania.proxy.sparkleFX(e1.worldObj, currentPos.x, currentPos.y, currentPos.z, r, g, b, 1F, 12);
|
||||
Botania.proxy.setSparkleFXNoClip(false);
|
||||
currentPos.add(movement);
|
||||
currentPos = currentPos.add(movement);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -177,15 +176,14 @@ public class PacketBotaniaEffect implements IMessage {
|
||||
if(e1 == null || e2 == null)
|
||||
return;
|
||||
|
||||
Vector3 thisVec = Vector3.fromEntityCenter(e1).add(0, 0, 0);
|
||||
Vector3 receiverVec = Vector3.fromEntityCenter(e2).add(0, 0, 0);
|
||||
Vector3 thisVec = Vector3.fromEntityCenter(e1);
|
||||
Vector3 receiverVec = Vector3.fromEntityCenter(e2);
|
||||
|
||||
double rc = 0.45;
|
||||
thisVec.add((Math.random() - 0.5) * rc, (Math.random() - 0.5) * rc, (Math.random() - 0.5) * rc);
|
||||
receiverVec.add((Math.random() - 0.5) * rc, (Math.random() - 0.5) * rc, (Math.random() - 0.5) * rc);
|
||||
|
||||
Vector3 motion = receiverVec.copy().sub(thisVec);
|
||||
motion.multiply(0.04F);
|
||||
Vector3 motion = receiverVec.subtract(thisVec).multiply(0.04F);
|
||||
float r = 0.4F + 0.3F * (float) Math.random();
|
||||
float g = 0.4F + 0.3F * (float) Math.random();
|
||||
float b = 0.4F + 0.3F * (float) Math.random();
|
||||
|
||||
Reference in new issue
Block a user