Search in sources :

Example 1 with Quat

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);
            }
        }
    });
}
Also used : TileQelaion(arekkuusu.solar.common.block.tile.TileQelaion) Quat(net.katsstuff.mirror.data.Quat) EnumFacing(net.minecraft.util.EnumFacing) Vector3(net.katsstuff.mirror.data.Vector3)

Example 2 with Quat

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();
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Quat(net.katsstuff.mirror.data.Quat) IBlockState(net.minecraft.block.state.IBlockState) ILumen(arekkuusu.solar.api.entanglement.energy.data.ILumen) EnumFacing(net.minecraft.util.EnumFacing) EntityLumen(arekkuusu.solar.common.entity.EntityLumen) BlockPos(net.minecraft.util.math.BlockPos) Vector3(net.katsstuff.mirror.data.Vector3)

Example 3 with Quat

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);
}
Also used : Quat(net.katsstuff.mirror.data.Quat) Vector3(net.katsstuff.mirror.data.Vector3)

Example 4 with Quat

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);
    }
}
Also used : Quat(net.katsstuff.mirror.data.Quat) EnumFacing(net.minecraft.util.EnumFacing) Vector3(net.katsstuff.mirror.data.Vector3)

Example 5 with Quat

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);
    }
}
Also used : Quat(net.katsstuff.mirror.data.Quat) EnumFacing(net.minecraft.util.EnumFacing) Vector3(net.katsstuff.mirror.data.Vector3)

Aggregations

Quat (net.katsstuff.mirror.data.Quat)8 Vector3 (net.katsstuff.mirror.data.Vector3)8 EnumFacing (net.minecraft.util.EnumFacing)5 ILumen (arekkuusu.solar.api.entanglement.energy.data.ILumen)1 TileQelaion (arekkuusu.solar.common.block.tile.TileQelaion)1 EntityLumen (arekkuusu.solar.common.entity.EntityLumen)1 MutableVector3 (net.katsstuff.mirror.data.MutableVector3)1 IBlockState (net.minecraft.block.state.IBlockState)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1