use of net.katsstuff.mirror.data.Quat in project Solar by ArekkuusuJerii.
the class BlockQelaion method randomDisplayTick.
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
getTile(TileQelaion.class, world, pos).ifPresent(qelaion -> {
Vector3 posVec = Vector3.Center().add(pos.getX(), pos.getY(), pos.getZ());
boolean on = state.getValue(HAS_NODE);
for (EnumFacing facing : EnumFacing.values()) {
if (qelaion.isInput(facing))
continue;
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.0025D * rand.nextDouble();
Vector3 speedVec = new Vector3.WrappedVec3i(facing.getDirectionVec()).asImmutable().multiply(speed).rotate(x.multiply(z));
FXUtil.spawnLight(world, posVec, speedVec, 60, 2F, on ? 0x49FFFF : 0xFF0303, Light.GLOW);
}
}
});
}
use of net.katsstuff.mirror.data.Quat in project Solar by ArekkuusuJerii.
the class TilePholarizer method spit.
private void spit() {
EnumFacing facing = getFacingLazy();
BlockPos pos = getPos().offset(facing);
IBlockState state = world.getBlockState(pos);
facing = facing.getOpposite();
TileEntity tile;
if (state.getBlock().hasTileEntity(state) && (tile = world.getTileEntity(pos)).hasCapability(ModCapability.LUMEN_CAPABILITY, facing)) {
ILumen wrapper = tile.getCapability(ModCapability.LUMEN_CAPABILITY, facing);
if (wrapper.get() > 0) {
EntityLumen lumen = EntityLumen.spawn(world, new Vector3.WrappedVec3i(getPos()).asImmutable().add(0.5D), wrapper.drain(64));
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 = new Vector3.WrappedVec3i(getFacingLazy().getOpposite().getDirectionVec()).asImmutable().rotate(x.multiply(z)).multiply(0.1D);
lumen.motionX = vec.x();
lumen.motionY = vec.y();
lumen.motionZ = vec.z();
}
}
}
use of net.katsstuff.mirror.data.Quat in project Solar by ArekkuusuJerii.
the class TileVacuumConveyor method spawnLightParticles.
private void spawnLightParticles(EnumFacing facing, boolean inverse) {
Vector3 back = getOffSet(facing);
facing = facing.getOpposite();
Quat x = Quat.fromAxisAngle(Vector3.Forward(), (world.rand.nextFloat() * 2F - 1F) * 5);
Quat z = Quat.fromAxisAngle(Vector3.Right(), (world.rand.nextFloat() * 2F - 1F) * 5);
double speed = world.rand.nextDouble() * 0.03D;
Vector3 speedVec = new Vector3.WrappedVec3i(facing.getDirectionVec()).asImmutable().rotate(x.multiply(z)).multiply(speed);
FXUtil.spawnMute(world, back, speedVec, 100, 2.5F, inverse ? 0xFFFFFF : 0x000000, GlowTexture.GLINT);
}
use of net.katsstuff.mirror.data.Quat in project Solar by ArekkuusuJerii.
the class BlockQimranut method randomDisplayTick.
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
EnumFacing facing = state.getValue(BlockDirectional.FACING);
Vector3 back = getOffSet(facing.getOpposite(), pos);
for (int i = 0; i < 3 + rand.nextInt(6); i++) {
Quat x = Quat.fromAxisAngle(Vector3.Forward(), (rand.nextFloat() * 2F - 1F) * 75);
Quat z = Quat.fromAxisAngle(Vector3.Right(), (rand.nextFloat() * 2F - 1F) * 75);
double speed = 0.005D + rand.nextDouble() * 0.005D;
Vector3 speedVec = new Vector3.WrappedVec3i(facing.getDirectionVec()).asImmutable().multiply(speed).rotate(x.multiply(z));
FXUtil.spawnLight(world, back, speedVec, 45, 2F, 0x1BE564, Light.GLOW);
}
}
use of net.katsstuff.mirror.data.Quat in project Solar by ArekkuusuJerii.
the class BlockBlinker method randomDisplayTick.
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
EnumFacing facing = state.getValue(BlockDirectional.FACING);
boolean active = state.getValue(State.ACTIVE);
Vector3 back = getOffSet(facing.getOpposite(), pos);
facing = facing.getOpposite();
for (int i = 0; i < 3 + rand.nextInt(6); i++) {
Quat x = Quat.fromAxisAngle(Vector3.Forward(), (rand.nextFloat() * 2F - 1F) * 5);
Quat z = Quat.fromAxisAngle(Vector3.Right(), (rand.nextFloat() * 2F - 1F) * 5);
double speed = 0.01D + rand.nextDouble() * 0.015D;
Vector3 speedVec = new Vector3.WrappedVec3i(facing.getDirectionVec()).asImmutable().multiply(speed).rotate(x.multiply(z));
FXUtil.spawnLight(world, back, speedVec, 60, 2.5F, active ? 0x49FFFF : 0xFFFFFF, Light.GLOW);
}
}
Aggregations