Search in sources :

Example 6 with Vector3

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

the class TileQuantumMirror method update.

@Override
public void update() {
    if (world.isRemote && world.rand.nextInt(10) == 0) {
        Vector3 from = Vector3.Center().add(pos.getX(), pos.getY(), pos.getZ());
        FXUtil.spawnMute(world, from, Vector3.rotateRandom().multiply(0.1F), 20, 0.1F, 0XFFFFFF, GlowTexture.STAR);
    }
}
Also used : Vector3(net.katsstuff.mirror.data.Vector3)

Example 7 with Vector3

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

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

the class AshenCubeStructure method genCubes.

private void genCubes(World world, BlockPos pos) {
    // Gen Cube
    BlockPos origin = pos.add(5, 0, 5);
    Template template = Structure.ASHEN_CUBE.load(world);
    boolean loot = GEN_CONFIG.ashen_cube.loot / 100D > random.nextDouble();
    PlacementSettings integrity = new PlacementSettings();
    integrity.setIntegrity(loot ? 1F : 0.35F + 0.45F * random.nextFloat());
    template.addBlocksToWorld(world, origin, integrity);
    integrity.setIntegrity(!loot && random.nextFloat() > 0.45F ? 1F : random.nextFloat());
    Structure.ASHEN_CUBE_.generate(world, origin, integrity);
    // Add loot
    for (int i = 0; i < 6 + random.nextInt(6); i++) {
        loot = GEN_CONFIG.monolith.structure.loot / 100D > random.nextDouble();
        if (loot) {
            BlockPos inside = origin.add(1 + random.nextInt(4), 1, 1 + random.nextInt(4));
            IBlockState pot = ModBlocks.LARGE_POT.getDefaultState().withProperty(BlockLargePot.POT_VARIANT, random.nextInt(3));
            world.setBlockState(inside, pot);
        }
    }
    // Gen Cubes
    AxisAlignedBB cubeBB = new AxisAlignedBB(origin, origin.add(template.getSize()));
    for (int i = 0; i < GEN_CONFIG.ashen_cube.size; i++) {
        Template cube = nuggets.next().load(world);
        Rotation rotation = Rotation.values()[random.nextInt(4)];
        Vector3 vec = rotate(new Vector3.WrappedVec3i(cube.getSize()).asImmutable(), rotation);
        BlockPos offset = pos.add(randomVector().toBlockPos());
        if (offset.getY() < 1 || (world.canSeeSky(offset) && GEN_CONFIG.ashen_cube.underground))
            continue;
        AxisAlignedBB nuggetBB = new AxisAlignedBB(offset, vec.add(new Vector3.WrappedVec3i(offset)).toBlockPos());
        if (!nuggetBB.intersects(cubeBB)) {
            PlacementSettings settings = new PlacementSettings();
            settings.setIntegrity(random.nextFloat() > 0.85F ? 0.9F : 0.35F + 0.45F * random.nextFloat());
            settings.setRotation(rotation);
            settings.setRandom(random);
            cube.addBlocksToWorld(world, offset, settings);
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) IBlockState(net.minecraft.block.state.IBlockState) BlockPos(net.minecraft.util.math.BlockPos) Vector3(net.katsstuff.mirror.data.Vector3) PlacementSettings(net.minecraft.world.gen.structure.template.PlacementSettings) Rotation(net.minecraft.util.Rotation) Template(net.minecraft.world.gen.structure.template.Template)

Example 9 with Vector3

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

the class BlockNeutronBattery method randomDisplayTick.

@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
    Vector3 vec = Vector3.apply(pos.getX(), pos.getY(), pos.getZ());
    Capacity capacity = state.getValue(CAPACITY);
    for (int i = 0; i < 3 + rand.nextInt(4); i++) {
        Vector3 posVec = vec.add(0.35D + 0.3D * rand.nextFloat(), 0.15D + 0.35D * rand.nextFloat(), 0.35D + 0.3D * rand.nextFloat());
        double speed = 0.005D + 0.005D * rand.nextDouble();
        Vector3 speedVec = Vector3.rotateRandom().multiply(speed);
        FXUtil.spawnLight(world, posVec, speedVec, 30, 2F, capacity.color, Light.GLOW);
        FXUtil.spawnLight(world, vec.add(0.5D), Vector3.Up().multiply(0.02D), 100, 2F, capacity.color, Light.GLOW);
    }
}
Also used : Capacity(arekkuusu.solar.common.block.tile.TileNeutronBattery.Capacity) Vector3(net.katsstuff.mirror.data.Vector3)

Example 10 with Vector3

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

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