use of net.katsstuff.mirror.data.Quat in project Solar by ArekkuusuJerii.
the class BlockDilaton method randomDisplayTick.
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
if (state.getValue(State.ACTIVE)) {
boolean powered = world.isBlockPowered(pos);
EnumFacing facing = state.getValue(BlockDirectional.FACING);
Vector3 posVec = Vector3.apply(pos.getX(), pos.getY(), pos.getZ()).add(0.5D);
for (int i = 0; i < 1 + rand.nextInt(3); i++) {
Quat x = Quat.fromAxisAngle(Vector3.Forward(), (rand.nextFloat() * 2F - 1F) * 6);
Quat z = Quat.fromAxisAngle(Vector3.Right(), (rand.nextFloat() * 2F - 1F) * 6);
double speed = 0.025D + 0.005D * rand.nextDouble();
Vector3 speedVec = new Vector3.WrappedVec3i(facing.getDirectionVec()).asImmutable().multiply(speed).rotate(x.multiply(z));
FXUtil.spawnLight(world, posVec, speedVec, 60, 2F, powered ? 0x49FFFF : 0xFF0303, Light.GLOW);
}
}
}
use of net.katsstuff.mirror.data.Quat in project Solar by ArekkuusuJerii.
the class EntityLumen method onUpdate.
@Override
public void onUpdate() {
super.onUpdate();
if (world.isRemote) {
int lumen = MathHelper.clamp(handler.get(), 0, 4);
Vector3 pos = Vector3.apply(posX, posY, posZ);
for (int i = 0; i < lumen; i++) {
Quat x = Quat.fromAxisAngle(Vector3.Forward(), (world.rand.nextFloat() * 2F - 1F) * 25F);
Quat z = Quat.fromAxisAngle(Vector3.Right(), (world.rand.nextFloat() * 2F - 1F) * 25F);
Vector3 vec = Vector3.apply(motionX, motionY, motionZ).rotate(x.multiply(z)).multiply(0.1D);
FXUtil.spawnTunneling(world, pos, vec, 30 + world.rand.nextInt(40), 2F, 0xFFE077, GlowTexture.GLINT);
}
} else {
double rest = 1D * (1 - (double) handler.get() / 1000D);
motionX *= rest;
motionY *= rest;
motionZ *= rest;
if (tick++ % 80 == 0 && tick > 1) {
handler.set((int) ((float) handler.get() * 0.75F));
}
if (handler.get() <= 0)
setDead();
}
move(MoverType.SELF, motionX, motionY, motionZ);
}
use of net.katsstuff.mirror.data.Quat in project Solar by ArekkuusuJerii.
the class ParticleVolt method calculateBolts.
private void calculateBolts() {
// TODO: Maybe use textures instead of raw gl lines?
ProfilerHelper.begin("[Particle Bolt] Calculating Bolts");
List<VoltSegment> branched = Lists.newArrayList();
for (int i = 0; i < generations; i++) {
List<VoltSegment> temp = Lists.newArrayList();
for (VoltSegment segment : segments) {
Vector3 from = segment.from;
Vector3 to = segment.to;
MutableVector3 mid = average(from, to).asMutable();
Vector3 midOffset = to.subtract(from);
mid = mid.add(midOffset.normalize().cross(Vector3.One()).multiply(Vector3.rotateRandom().multiply(offset)));
if (branch && rand.nextDouble() > 0.6D) {
MutableVector3 direction = mid.subtract(from);
float xAngle = (25.0F + 12.5F * rand.nextFloat()) * (rand.nextBoolean() ? 1 : -1);
float zAngle = (25.0F + 12.5F * rand.nextFloat()) * (rand.nextBoolean() ? 1 : -1);
Quat x = Quat.fromAxisAngle(Vector3.Forward(), xAngle);
Quat z = Quat.fromAxisAngle(Vector3.Right(), zAngle);
Vector3 splitEnd = direction.rotate(x.multiply(z)).multiply(0.7D).add(mid).asImmutable();
VoltSegment sub = new VoltSegment(mid.asImmutable(), splitEnd);
sub.alpha = segment.alpha;
temp.add(sub);
}
VoltSegment one = new VoltSegment(from, mid.asImmutable());
VoltSegment two = new VoltSegment(mid.asImmutable(), to);
if (fade) {
one.alpha = segment.alpha * 0.5F;
two.alpha = segment.alpha;
}
temp.add(one);
temp.add(two);
if (branched.isEmpty() || branched.contains(segment)) {
branched.add(two);
}
}
segments = temp;
offset /= 2;
}
ProfilerHelper.end();
}
Aggregations