Search in sources :

Example 1 with EntityDiggingFX

use of net.minecraft.client.particle.EntityDiggingFX in project LogisticsPipes by RS485.

the class LogisticsBlockGenericPipe method addHitEffects.

/**
	 * Spawn a digging particle effect in the world, this is a wrapper around
	 * EffectRenderer.addBlockHitEffects to allow the block more control over
	 * the particles. Useful when you have entirely different texture sheets for
	 * different sides/locations in the world.
	 *
	 * @param worldObj
	 *            The current world
	 * @param target
	 *            The target the player is looking at {x/y/z/side/sub}
	 * @param effectRenderer
	 *            A reference to the current effect renderer.
	 * @return True to prevent vanilla digging particles form spawning.
	 */
@SideOnly(Side.CLIENT)
@Override
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
    int x = target.blockX;
    int y = target.blockY;
    int z = target.blockZ;
    CoreUnroutedPipe pipe = LogisticsBlockGenericPipe.getPipe(worldObj, x, y, z);
    if (pipe == null) {
        return false;
    }
    IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
    int sideHit = target.sideHit;
    Block block = LogisticsPipes.LogisticsPipeBlock;
    float b = 0.1F;
    double px = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (b * 2.0F)) + b + block.getBlockBoundsMinX();
    double py = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (b * 2.0F)) + b + block.getBlockBoundsMinY();
    double pz = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (b * 2.0F)) + b + block.getBlockBoundsMinZ();
    if (sideHit == 0) {
        py = y + block.getBlockBoundsMinY() - b;
    }
    if (sideHit == 1) {
        py = y + block.getBlockBoundsMaxY() + b;
    }
    if (sideHit == 2) {
        pz = z + block.getBlockBoundsMinZ() - b;
    }
    if (sideHit == 3) {
        pz = z + block.getBlockBoundsMaxZ() + b;
    }
    if (sideHit == 4) {
        px = x + block.getBlockBoundsMinX() - b;
    }
    if (sideHit == 5) {
        px = x + block.getBlockBoundsMaxX() + b;
    }
    EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, 0.0D, 0.0D, 0.0D, block, sideHit, worldObj.getBlockMetadata(x, y, z));
    fx.setParticleIcon(icon);
    effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
    return true;
}
Also used : EntityDiggingFX(net.minecraft.client.particle.EntityDiggingFX) IIcon(net.minecraft.util.IIcon) Block(net.minecraft.block.Block) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 2 with EntityDiggingFX

use of net.minecraft.client.particle.EntityDiggingFX in project LogisticsPipes by RS485.

the class LogisticsBlockGenericSubMultiBlock method addHitEffects.

@Override
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
    int x = target.blockX;
    int y = target.blockY;
    int z = target.blockZ;
    DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
    TileEntity tile = pos.getTileEntity(worldObj);
    if (tile instanceof LogisticsTileGenericSubMultiBlock) {
        List<LogisticsTileGenericPipe> mainPipeList = ((LogisticsTileGenericSubMultiBlock) tile).getMainPipe();
        for (LogisticsTileGenericPipe mainPipe : mainPipeList) {
            if (mainPipe != null && mainPipe.pipe != null && mainPipe.pipe.isMultiBlock()) {
                if (LogisticsPipes.LogisticsPipeBlock.doRayTrace(worldObj, mainPipe.xCoord, mainPipe.yCoord, mainPipe.zCoord, Minecraft.getMinecraft().thePlayer) != null) {
                    CoreUnroutedPipe pipe = mainPipe.pipe;
                    if (pipe == null) {
                        return false;
                    }
                    IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
                    int sideHit = target.sideHit;
                    Block block = LogisticsPipes.LogisticsPipeBlock;
                    float b = 0.1F;
                    double px = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (b * 2.0F)) + b + block.getBlockBoundsMinX();
                    double py = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (b * 2.0F)) + b + block.getBlockBoundsMinY();
                    double pz = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (b * 2.0F)) + b + block.getBlockBoundsMinZ();
                    if (sideHit == 0) {
                        py = y + block.getBlockBoundsMinY() - b;
                    }
                    if (sideHit == 1) {
                        py = y + block.getBlockBoundsMaxY() + b;
                    }
                    if (sideHit == 2) {
                        pz = z + block.getBlockBoundsMinZ() - b;
                    }
                    if (sideHit == 3) {
                        pz = z + block.getBlockBoundsMaxZ() + b;
                    }
                    if (sideHit == 4) {
                        px = x + block.getBlockBoundsMinX() - b;
                    }
                    if (sideHit == 5) {
                        px = x + block.getBlockBoundsMaxX() + b;
                    }
                    EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, 0.0D, 0.0D, 0.0D, block, sideHit, worldObj.getBlockMetadata(x, y, z));
                    fx.setParticleIcon(icon);
                    effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
                    return true;
                }
            }
        }
    }
    return super.addHitEffects(worldObj, target, effectRenderer);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EntityDiggingFX(net.minecraft.client.particle.EntityDiggingFX) IIcon(net.minecraft.util.IIcon) Block(net.minecraft.block.Block) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 3 with EntityDiggingFX

use of net.minecraft.client.particle.EntityDiggingFX in project LogisticsPipes by RS485.

the class LogisticsBlockGenericPipe method addDestroyEffects.

/**
	 * Spawn particles for when the block is destroyed. Due to the nature of how
	 * this is invoked, the x/y/z locations are not always guaranteed to host
	 * your block. So be sure to do proper sanity checks before assuming that
	 * the location is this block.
	 *
	 * @param worldObj
	 *            The current world
	 * @param x
	 *            X position to spawn the particle
	 * @param y
	 *            Y position to spawn the particle
	 * @param z
	 *            Z position to spawn the particle
	 * @param meta
	 *            The metadata for the block before it was destroyed.
	 * @param effectRenderer
	 *            A reference to the current effect renderer.
	 * @return True to prevent vanilla break particles from spawning.
	 */
@SideOnly(Side.CLIENT)
@Override
public boolean addDestroyEffects(World worldObj, int x, int y, int z, int meta, EffectRenderer effectRenderer) {
    CoreUnroutedPipe pipe = LogisticsBlockGenericPipe.getPipe(worldObj, x, y, z);
    if (pipe == null) {
        return false;
    }
    PlayerConfig config = LogisticsPipes.getClientPlayerConfig();
    if (config.isUseNewRenderer()) {
        LogisticsNewRenderPipe.renderDestruction(pipe, worldObj, x, y, z, effectRenderer);
    } else {
        IIcon icon = pipe.getIconProvider().getIcon(pipe.getIconIndexForItem());
        byte its = 4;
        for (int i = 0; i < its; ++i) {
            for (int j = 0; j < its; ++j) {
                for (int k = 0; k < its; ++k) {
                    if (pipe.isMultiBlock()) {
                        LPPositionSet<DoubleCoordinatesType<CoreMultiBlockPipe.SubBlockTypeForShare>> set = ((CoreMultiBlockPipe) pipe).getRotatedSubBlocks();
                        set.add(new DoubleCoordinatesType<>(0, 0, 0, CoreMultiBlockPipe.SubBlockTypeForShare.NON_SHARE));
                        for (DoubleCoordinates pos : set) {
                            int localx = x + pos.getXInt();
                            int localy = y + pos.getYInt();
                            int localz = z + pos.getZInt();
                            double px = localx + (i + 0.5D) / its;
                            double py = localy + (j + 0.5D) / its;
                            double pz = localz + (k + 0.5D) / its;
                            int random = rand.nextInt(6);
                            EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, px - localx - 0.5D, py - localy - 0.5D, pz - localz - 0.5D, LogisticsPipes.LogisticsPipeBlock, random, meta);
                            fx.setParticleIcon(icon);
                            effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z));
                        }
                    } else {
                        double px = x + (i + 0.5D) / its;
                        double py = y + (j + 0.5D) / its;
                        double pz = z + (k + 0.5D) / its;
                        int random = rand.nextInt(6);
                        EntityDiggingFX fx = new EntityDiggingFX(worldObj, px, py, pz, px - x - 0.5D, py - y - 0.5D, pz - z - 0.5D, LogisticsPipes.LogisticsPipeBlock, random, meta);
                        fx.setParticleIcon(icon);
                        effectRenderer.addEffect(fx.applyColourMultiplier(x, y, z));
                    }
                }
            }
        }
    }
    return true;
}
Also used : EntityDiggingFX(net.minecraft.client.particle.EntityDiggingFX) DoubleCoordinatesType(network.rs485.logisticspipes.world.DoubleCoordinatesType) IIcon(net.minecraft.util.IIcon) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates) PlayerConfig(logisticspipes.config.PlayerConfig) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 4 with EntityDiggingFX

use of net.minecraft.client.particle.EntityDiggingFX in project ArsMagica2 by Mithion.

the class BlockEverstone method addHitEffects.

@Override
@SideOnly(Side.CLIENT)
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
    TileEntityEverstone everstone = getTE(worldObj, target.blockX, target.blockY, target.blockZ);
    AMParticle particle;
    Block block;
    int blockMeta = 0;
    if (everstone == null || everstone.getFacade() == null) {
        block = this;
    } else {
        block = everstone.getFacade();
        if (block == null)
            block = this;
        blockMeta = everstone.getFacadeMeta();
    }
    effectRenderer.addEffect(new EntityDiggingFX(worldObj, target.blockX + worldObj.rand.nextDouble(), target.blockY + worldObj.rand.nextDouble(), target.blockZ + worldObj.rand.nextDouble(), 0, 0, 0, block, blockMeta, 0));
    return true;
}
Also used : EntityDiggingFX(net.minecraft.client.particle.EntityDiggingFX) AMParticle(am2.particles.AMParticle) Block(net.minecraft.block.Block) ItemBlock(net.minecraft.item.ItemBlock) TileEntityEverstone(am2.blocks.tileentities.TileEntityEverstone) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 5 with EntityDiggingFX

use of net.minecraft.client.particle.EntityDiggingFX in project ICBM-Classic by BuiltBrokenModding.

the class ClientProxy method spawnParticle.

@Override
public void spawnParticle(String name, World world, IPos3D position, double motionX, double motionY, double motionZ, float red, float green, float blue, float scale, double distance) {
    EntityFX fx = null;
    if (name.equals("smoke")) {
        fx = new FXSmoke(world, new Pos(position), red, green, blue, scale, distance);
    } else if (name.equals("missile_smoke")) {
        fx = (new FXSmoke(world, new Pos(position), red, green, blue, scale, distance)).setAge(100);
    } else if (name.equals("portal")) {
        fx = new FXEnderPortalPartical(world, new Pos(position), red, green, blue, scale, distance);
    } else if (name.equals("antimatter")) {
        fx = new FXAntimatterPartical(world, new Pos(position), red, green, blue, scale, distance);
    } else if (name.equals("digging")) {
        fx = new EntityDiggingFX(world, position.x(), position.y(), position.z(), motionX, motionY, motionZ, Block.getBlockById((int) red), 0, (int) green);
        fx.multipleParticleScaleBy(blue);
    } else if (name.equals("shockwave")) {
    //fx = new FXShockWave(world, new Pos(position), red, green, blue, scale, distance);
    }
    if (fx != null) {
        fx.motionX = motionX;
        fx.motionY = motionY;
        fx.motionZ = motionZ;
        FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
    }
}
Also used : EntityDiggingFX(net.minecraft.client.particle.EntityDiggingFX) FXAntimatterPartical(icbm.classic.client.fx.FXAntimatterPartical) Pos(com.builtbroken.mc.imp.transform.vector.Pos) EntityFX(net.minecraft.client.particle.EntityFX) FXEnderPortalPartical(com.builtbroken.mc.lib.render.fx.FXEnderPortalPartical) FXSmoke(com.builtbroken.mc.lib.render.fx.FXSmoke)

Aggregations

EntityDiggingFX (net.minecraft.client.particle.EntityDiggingFX)6 SideOnly (cpw.mods.fml.relauncher.SideOnly)4 Block (net.minecraft.block.Block)4 IIcon (net.minecraft.util.IIcon)3 TileEntityEverstone (am2.blocks.tileentities.TileEntityEverstone)2 ItemBlock (net.minecraft.item.ItemBlock)2 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)2 AMParticle (am2.particles.AMParticle)1 Pos (com.builtbroken.mc.imp.transform.vector.Pos)1 FXEnderPortalPartical (com.builtbroken.mc.lib.render.fx.FXEnderPortalPartical)1 FXSmoke (com.builtbroken.mc.lib.render.fx.FXSmoke)1 FXAntimatterPartical (icbm.classic.client.fx.FXAntimatterPartical)1 PlayerConfig (logisticspipes.config.PlayerConfig)1 EntityFX (net.minecraft.client.particle.EntityFX)1 TileEntity (net.minecraft.tileentity.TileEntity)1 DoubleCoordinatesType (network.rs485.logisticspipes.world.DoubleCoordinatesType)1