Search in sources :

Example 1 with Vector3

use of net.katsstuff.mirror.data.Vector3 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 Vector3

use of net.katsstuff.mirror.data.Vector3 in project Solar by ArekkuusuJerii.

the class BlockSchrodingerGlyph method randomDisplayTick.

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
    if (world.isRemote && rand.nextInt(15) == 0 && getClosestPlayer(world, pos).isPresent()) {
        for (EnumFacing facing : EnumFacing.values()) {
            Vector3 from = Vector3.Center().add(pos.getX(), pos.getY(), pos.getZ());
            Vector3 vec = new Vector3.WrappedVec3i(facing.getDirectionVec()).asImmutable().multiply(0.025D);
            FXUtil.spawnNeutron(world, from, vec, 60, 0.25F, 0xFF0303, false);
        }
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) Vector3(net.katsstuff.mirror.data.Vector3) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with Vector3

use of net.katsstuff.mirror.data.Vector3 in project Solar by ArekkuusuJerii.

the class BlockElectron method randomDisplayTick.

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
    if (state.getValue(State.POWER) > 0 && world.rand.nextBoolean()) {
        for (int i = 0; i < 1 + world.rand.nextInt(3); i++) {
            Vector3 from = Vector3.Center().add(pos.getX(), pos.getY(), pos.getZ());
            Vector3 to = Vector3.rotateRandom().add(from);
            FXUtil.spawnVolt(world, from, to, 4, 0.25F, 15, 0x5194FF, true, true);
        }
        FXUtil.playSound(world, pos, SolarSounds.SPARK, SoundCategory.BLOCKS, 0.05F);
    }
}
Also used : Vector3(net.katsstuff.mirror.data.Vector3) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with Vector3

use of net.katsstuff.mirror.data.Vector3 in project Solar by ArekkuusuJerii.

the class BlockHyperConductor method randomDisplayTick.

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
    Vector3 origin = Vector3.Center().add(pos.getX(), pos.getY(), pos.getZ());
    for (EnumFacing facing : EnumFacing.values()) {
        Vector3 vec = new Vector3.WrappedVec3i(facing.getDirectionVec()).asImmutable().multiply(0.025D);
        FXUtil.spawnSquared(world, origin, vec, 40, 4F, 0xFFFFFF);
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) Vector3(net.katsstuff.mirror.data.Vector3) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 5 with Vector3

use of net.katsstuff.mirror.data.Vector3 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)

Aggregations

Vector3 (net.katsstuff.mirror.data.Vector3)23 Quat (net.katsstuff.mirror.data.Quat)8 EnumFacing (net.minecraft.util.EnumFacing)8 BlockPos (net.minecraft.util.math.BlockPos)7 IBlockState (net.minecraft.block.state.IBlockState)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)4 ItemStack (net.minecraft.item.ItemStack)3 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)3 Rotation (net.minecraft.util.Rotation)2 RayTraceResult (net.minecraft.util.math.RayTraceResult)2 PlacementSettings (net.minecraft.world.gen.structure.template.PlacementSettings)2 Template (net.minecraft.world.gen.structure.template.Template)2 ILumen (arekkuusu.solar.api.entanglement.energy.data.ILumen)1 Capacity (arekkuusu.solar.common.block.tile.TileNeutronBattery.Capacity)1 TileQelaion (arekkuusu.solar.common.block.tile.TileQelaion)1 EntityLumen (arekkuusu.solar.common.entity.EntityLumen)1 EntityTemporalItem (arekkuusu.solar.common.entity.EntityTemporalItem)1 MutableVector3 (net.katsstuff.mirror.data.MutableVector3)1 SoundType (net.minecraft.block.SoundType)1 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)1