Search in sources :

Example 6 with Vector3

use of codechicken.lib.vec.Vector3 in project CodeChickenLib by Chicken-Bones.

the class EntityDigIconFX method addBlockHitEffects.

public static void addBlockHitEffects(World world, Cuboid6 bounds, int side, TextureAtlasSprite icon, EffectRenderer effectRenderer) {
    float border = 0.1F;
    Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2 * border);
    diff.x *= world.rand.nextDouble();
    diff.y *= world.rand.nextDouble();
    diff.z *= world.rand.nextDouble();
    Vector3 pos = diff.add(bounds.min).add(border);
    if (side == 0)
        diff.y = bounds.min.y - border;
    if (side == 1)
        diff.y = bounds.max.y + border;
    if (side == 2)
        diff.z = bounds.min.z - border;
    if (side == 3)
        diff.z = bounds.max.z + border;
    if (side == 4)
        diff.x = bounds.min.x - border;
    if (side == 5)
        diff.x = bounds.max.x + border;
    effectRenderer.addEffect(new EntityDigIconFX(world, pos.x, pos.y, pos.z, 0, 0, 0, icon).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
Also used : Vector3(codechicken.lib.vec.Vector3)

Example 7 with Vector3

use of codechicken.lib.vec.Vector3 in project CodeChickenLib by Chicken-Bones.

the class EntityDigIconFX method addBlockDestroyEffects.

public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAtlasSprite[] icons, EffectRenderer effectRenderer) {
    Vector3 diff = bounds.max.copy().subtract(bounds.min);
    Vector3 center = bounds.min.copy().add(bounds.max).multiply(0.5);
    Vector3 density = diff.copy().multiply(4);
    density.x = Math.ceil(density.x);
    density.y = Math.ceil(density.y);
    density.z = Math.ceil(density.z);
    for (int i = 0; i < density.x; ++i) for (int j = 0; j < density.y; ++j) for (int k = 0; k < density.z; ++k) {
        double x = bounds.min.x + (i + 0.5) * diff.x / density.x;
        double y = bounds.min.y + (j + 0.5) * diff.y / density.y;
        double z = bounds.min.z + (k + 0.5) * diff.z / density.z;
        effectRenderer.addEffect(new EntityDigIconFX(world, x, y, z, x - center.x, y - center.y, z - center.z, icons[world.rand.nextInt(icons.length)]));
    }
}
Also used : Vector3(codechicken.lib.vec.Vector3)

Example 8 with Vector3

use of codechicken.lib.vec.Vector3 in project CodeChickenLib by Chicken-Bones.

the class RenderUtils method renderFluidCuboid.

public static void renderFluidCuboid(Cuboid6 bound, TextureAtlasSprite tex, double res) {
    renderFluidQuad(new Vector3(bound.min.x, bound.min.y, bound.min.z), new Vector3(bound.max.x, bound.min.y, bound.min.z), new Vector3(bound.max.x, bound.min.y, bound.max.z), new Vector3(bound.min.x, bound.min.y, bound.max.z), tex, res);
    renderFluidQuad(new Vector3(bound.min.x, bound.max.y, bound.min.z), new Vector3(bound.min.x, bound.max.y, bound.max.z), new Vector3(bound.max.x, bound.max.y, bound.max.z), new Vector3(bound.max.x, bound.max.y, bound.min.z), tex, res);
    renderFluidQuad(new Vector3(bound.min.x, bound.max.y, bound.min.z), new Vector3(bound.min.x, bound.min.y, bound.min.z), new Vector3(bound.min.x, bound.min.y, bound.max.z), new Vector3(bound.min.x, bound.max.y, bound.max.z), tex, res);
    renderFluidQuad(new Vector3(bound.max.x, bound.max.y, bound.max.z), new Vector3(bound.max.x, bound.min.y, bound.max.z), new Vector3(bound.max.x, bound.min.y, bound.min.z), new Vector3(bound.max.x, bound.max.y, bound.min.z), tex, res);
    renderFluidQuad(new Vector3(bound.max.x, bound.max.y, bound.min.z), new Vector3(bound.max.x, bound.min.y, bound.min.z), new Vector3(bound.min.x, bound.min.y, bound.min.z), new Vector3(bound.min.x, bound.max.y, bound.min.z), tex, res);
    renderFluidQuad(new Vector3(bound.min.x, bound.max.y, bound.max.z), new Vector3(bound.min.x, bound.min.y, bound.max.z), new Vector3(bound.max.x, bound.min.y, bound.max.z), new Vector3(bound.max.x, bound.max.y, bound.max.z), tex, res);
}
Also used : Vector3(codechicken.lib.vec.Vector3)

Example 9 with Vector3

use of codechicken.lib.vec.Vector3 in project CodeChickenLib by Chicken-Bones.

the class RenderUtils method renderFluidGauge.

public static void renderFluidGauge(FluidStack stack, Rectangle4i rect, double density, double res) {
    if (!shouldRenderFluid(stack))
        return;
    int alpha = 255;
    if (stack.getFluid().isGaseous())
        alpha = (int) (fluidDensityToAlpha(density) * 255);
    else {
        int height = (int) (rect.h * density);
        rect.y += rect.h - height;
        rect.h = height;
    }
    TextureAtlasSprite tex = prepareFluidRender(stack, alpha);
    CCRenderState.startDrawing();
    renderFluidQuad(new Vector3(rect.x, rect.y + rect.h, 0), new Vector3(rect.w, 0, 0), new Vector3(0, -rect.h, 0), tex, res);
    CCRenderState.draw();
    postFluidRender();
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Vector3(codechicken.lib.vec.Vector3)

Aggregations

Vector3 (codechicken.lib.vec.Vector3)9 BlockCoord (codechicken.lib.vec.BlockCoord)1 TileMultipart (codechicken.multipart.TileMultipart)1 Block (net.minecraft.block.Block)1 WorldRenderer (net.minecraft.client.renderer.WorldRenderer)1 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)1 ItemStack (net.minecraft.item.ItemStack)1 C08PacketPlayerBlockPlacement (net.minecraft.network.play.client.C08PacketPlayerBlockPlacement)1 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)1 PlayerDestroyItemEvent (net.minecraftforge.event.entity.player.PlayerDestroyItemEvent)1