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;
}
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);
}
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;
}
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;
}
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);
}
}
Aggregations