本文整理匯總了Java中net.minecraft.client.particle.EffectRenderer.addEffect方法的典型用法代碼示例。如果您正苦於以下問題:Java EffectRenderer.addEffect方法的具體用法?Java EffectRenderer.addEffect怎麽用?Java EffectRenderer.addEffect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.client.particle.EffectRenderer
的用法示例。
在下文中一共展示了EffectRenderer.addEffect方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addBlockHitEffects
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
public static void addBlockHitEffects(World world, Cuboid6 bounds, int side, IIcon 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));
}
示例2: spawnBigParticles
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public void spawnBigParticles(int temp, float speed)
{
EffectRenderer renderer = FMLClientHandler.instance().getClient().effectRenderer;
if (this.currentAttackID == 4) {
temp *= 2;
}
for (int i = 0; i < temp; i++)
{
float f = (this.rand.nextFloat() - 0.5F) * speed;
float f1 = (this.rand.nextFloat() - 0.5F) * speed;
float f2 = (this.rand.nextFloat() - 0.5F) * speed;
boolean flag = i < temp / 2;
if (this.currentAttackID != 4) {
flag = true;
}
boolean death = this.currentAttackID != 10;
double h = death ? this.height : this.height + 1.0F;
double w = death ? this.width : this.width * 1.5F;
double tempX = (flag ? this.posX : this.teleX) + (this.rand.nextDouble() - 0.5D) * w;
double tempY = (flag ? this.posY : this.teleY) + (this.rand.nextDouble() - 0.5D) * h + (death ? 1.5F : 0.5F);
double tempZ = (flag ? this.posZ : this.teleZ) + (this.rand.nextDouble() - 0.5D) * w;
renderer.addEffect(new FXEnder(this.worldObj, tempX, tempY, tempZ, f, f1, f2, true));
}
}
示例3: addDestroyEffect
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
/**
* Produces block destruction particles at coordinates.
*/
public static void addDestroyEffect(World world, int x, int y, int z, ItemStack itemStack, EffectRenderer effectRenderer)
{
BlockProperties.prepareItemStackForRendering(itemStack);
byte factor = 4;
for (int posX = 0; posX < factor; ++posX)
{
for (int posY = 0; posY < factor; ++posY)
{
for (int posZ = 0; posZ < factor; ++posZ)
{
double dirX = x + (posX + 0.5D) / factor;
double dirY = y + (posY + 0.5D) / factor;
double dirZ = z + (posZ + 0.5D) / factor;
EntityDiggingFX particle = new EntityDiggingFX(world, dirX, dirY, dirZ, dirX - x - 0.5D, dirY - y - 0.5D, dirZ - z - 0.5D, BlockProperties.toBlock(itemStack), itemStack.getItemDamage());
effectRenderer.addEffect(particle.applyColourMultiplier(x, y, z));
}
}
}
}
示例4: perform
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void perform(EffectInstance inst) {
double x = ((Number) inst.data[0]).doubleValue();
double y = ((Number) inst.data[1]).doubleValue();
double z = ((Number) inst.data[2]).doubleValue();
double dx = ((Number) inst.data[3]).doubleValue();
double dy = ((Number) inst.data[4]).doubleValue();
double dz = ((Number) inst.data[5]).doubleValue();
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
double d = Math.sqrt(dx*dx + dy*dy + dz*dz);
for (double i = 0; i < d; i += trailStep) {
EntityFX particle = new ParticleDust(Minecraft.getMinecraft().theWorld,
x + dx * i/d,
y + dy * i/d,
z + dz * i/d, 0, 0, 0);
effectRenderer.addEffect(particle);
}
}
示例5: perform
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public void perform(Entity entity, Object ... data) {
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
Random rand = new Random();
for (int i = 0; i < MAX_PARTICLES; i++) {
float yaw = (rand.nextFloat()*2.0F - 1.0F) * (float) Math.PI;
float pitch = (rand.nextFloat() - 0.5F) * (float) Math.PI;
double distance = rand.nextDouble() * 0.3D + 0.2D;
double cosYaw = (double) MathHelper.cos(yaw);
double sinYaw = (double) MathHelper.sin(yaw);
double cosPitch = (double) MathHelper.cos(pitch);
double sinPitch = (double) MathHelper.sin(pitch);
double rX = -sinYaw*cosPitch * distance;
double rZ = cosYaw*cosPitch * distance;
double rY = -sinPitch * distance;
/*double velX = -sinYaw*cosPitch / (distance) * 0.05D;
double velZ = cosYaw*cosPitch / (distance) * 0.05D;
double velY = -sinPitch / (distance) * 0.05D;*/
EntityFX particle = new ParticleLifesteal(entity.worldObj,
entity.posX + rX, entity.posY - entity.yOffset + 1 + rY, entity.posZ + rZ, distance);
effectRenderer.addEffect(particle);
}
}
示例6: emitParticles
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
private void emitParticles() {
int particleLevel = Minecraft.getMinecraft().gameSettings.particleSetting;
if (particleLevel >= 2) return;
double r = 7.0 / 16.0;
double v = getVelocity(EnumFacing.UP) * r;
double bottom = -3.0 / 16.0;
double left = -4.0 / 16.0;
double scootch_x = 3.0 / 16.0;
double scootch_y = 3.0 / 16.0;
Quaternion rot = Quaternion.getRotationQuaternionRadians(angle, EnumFacing.UP);
double motFuzz = v / 20;
Random rng = worldObj.rand;
double threshold = velocity / (particleLevel == 1 ? 1 : 4);
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
for (int side = 0; side < 4; side++) {
for (int y = 0; y < 3; y++) {
if (rng.nextFloat() > threshold) continue;
Vec3 pos = new Vec3(left + scootch_x * y, bottom + scootch_y * y, r);
Vec3 mot = new Vec3(-v + rng.nextGaussian() * motFuzz * 3, rng.nextGaussian() * motFuzz, rng.nextGaussian() * motFuzz + r * 0.125);
rot.applyRotation(pos);
rot.applyRotation(mot);
EntityFXSteam steam = new EntityFXSteam(worldObj, pos.xCoord + 0.5 + pos.xCoord, pos.yCoord + 0.5 + pos.yCoord, pos.zCoord + 0.5 + pos.zCoord);
SpaceUtil.toEntVel(steam, mot);
effectRenderer.addEffect(steam);
}
rot.incrMultiply(Quaternion.getRotationQuaternionRadians(Math.PI / 2, EnumFacing.UP));
}
}
示例7: spawnParticles
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
void spawnParticles() {
final double r = 0.5;
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
for (double dy = 0; dy < height; dy += r) {
EntityFXSteam particle = new EntityFXSteam(worldObj, posX, posY + dy, posZ);
particle.motionX = rand.nextGaussian() / 16;
particle.motionY = 0.3 + Math.abs(rand.nextGaussian()) / 16;
particle.motionZ = rand.nextGaussian() / 16;
effectRenderer.addEffect(particle);
}
}
示例8: addHitEffects
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) {
Double[] coords = getOffsetCoordsForSide(target.blockX+.5, target.blockY+.5, target.blockZ+.5, target.sideHit);
effectRenderer.addEffect(new BreakEffect(worldObj, coords[0], coords[1], coords[2], rng.nextGaussian(), rng.nextGaussian(), rng.nextGaussian()));
return true;
}
示例9: AAFillParticles
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
public static void AAFillParticles(World worldObj, int xCoord, int yCoord, int zCoord)
{
boolean PARTICLES_ALLOWED = Configurations.ENABLE_WATER_GEN_PARTICLES;
int WATER_GEN = Configurations.WATER_GEN_PER_TICK;
if (!PARTICLES_ALLOWED || !(worldObj.isRemote))
{
return;
}
EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer;
double theta;
double radius;
double baseSpeed = 0.01;
double random;
double baseLife = 25;
EntityFX fluidOrb;
double d1;
double d2;
for (int i=0;i<=((int)((double)WATER_GEN/5.0));i++)
{
theta = MathHelper.randomRad();
radius = MathHelper.randomDoubleBetween(0.05,0.45);
random = MathHelper.randomDoubleBetween(0.75,1.0);
d1 = radius*Math.sin(theta);
d2 = radius*Math.cos(theta);
fluidOrb = new ParticleFluidOrb(worldObj,xCoord+0.5+d1,yCoord,zCoord+0.5+d2,-d1*random/baseLife,baseSpeed*random,-d2*random/baseLife,waterFluid,0,((int)(baseLife/random)));
renderer.addEffect(fluidOrb);
}
}
示例10: AATransferParticles
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
public static void AATransferParticles(World worldObj,int xCoord, int yCoord, int zCoord, int x, int y, int z, int transferred)
{
boolean PARTICLES_ALLOWED = Configurations.ENABLE_WATER_GEN_PARTICLES;
if (!PARTICLES_ALLOWED || !(worldObj.isRemote))
{
return;
}
// LogHelper.info("Inside transferParticles");
EffectRenderer renderer = Minecraft.getMinecraft().effectRenderer;
EntityFX fluidOrb;// = new ParticleFluidOrbArc(worldObj,this.xCoord+0.5,this.yCoord+0.51,this.zCoord+0.5,x+0.5,y+0.5,z+0.5,waterFluid,10);
// renderer.addEffect(fluidOrb);
int baseLife = 10;
int lifeRandomizer;
double xRand;
double zRand;
int numParticles = Math.max(1, (int) ((double) transferred / 250));
for (int i=0;i<numParticles;i++)
{
lifeRandomizer = MathHelper.randomIntInclusiveBetween(-1,1);
xRand = MathHelper.randomDoubleBetween(0.45,0.55);
zRand = MathHelper.randomDoubleBetween(0.45,0.55);
fluidOrb = new ParticleFluidOrbArc(worldObj,xCoord+xRand,yCoord+0.51,zCoord+zRand,x+0.5,y+0.5,z+0.5,waterFluid,baseLife+lifeRandomizer);
renderer.addEffect(fluidOrb);
}
}
示例11: addHitEffects
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer)
{
int side = target.sideHit;
int x = target.blockX;
int y = target.blockY;
int z = target.blockZ;
if (getMaterial() != Material.air)
{
float offset = 0.1F;
double pX = (double)x + world.rand.nextDouble() * (getBlockBoundsMaxX() - getBlockBoundsMinX() - (double)(offset * 2.0F)) + (double)offset + getBlockBoundsMinX();
double pY = (double)y + world.rand.nextDouble() * (getBlockBoundsMaxY() - getBlockBoundsMinY() - (double)(offset * 2.0F)) + (double)offset + getBlockBoundsMinY();
double pZ = (double)z + world.rand.nextDouble() * (getBlockBoundsMaxZ() - getBlockBoundsMinZ() - (double)(offset * 2.0F)) + (double)offset + getBlockBoundsMinZ();
ForgeDirection dir = ForgeDirection.getOrientation(side);
pX = dir.offsetX == 0 ? pX : x + Math.max(0, dir.offsetX) + (offset * dir.offsetX);
pY = dir.offsetY == 0 ? pY : y + Math.max(0, dir.offsetY) + (offset * dir.offsetY);
pZ = dir.offsetZ == 0 ? pZ : z + Math.max(0, dir.offsetZ) + (offset * dir.offsetZ);
effectRenderer.addEffect((new EntityDiggingFX(world, pX, pY, pZ, 0.0D, 0.0D, 0.0D, ((TileIllumination)world.getTileEntity(x, y, z)).camoBlock, world.getBlockMetadata(x, y, z)).applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)));
}
return true;
}
示例12: addBlockHitEffects
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
public static void addBlockHitEffects(World world, Cuboid6 bounds, int side, IIcon 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));
}
示例13: addDestroyEffects
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer)
{
if(world.getBlockMetadata(x, y, z) == 2 || world.getBlockMetadata(x, y, z) == 10)
{
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof IAdaptableTile)
{
IAdaptableTile tileAdaptable = (IAdaptableTile)te;
if(tileAdaptable.getBlockForTexture() != null)
{
byte b0 = 4;
for(int i1 = 0; i1 < b0; ++i1)
{
for(int j1 = 0; j1 < b0; ++j1)
{
for(int k1 = 0; k1 < b0; ++k1)
{
double d0 = (double)x + ((double)i1 + 0.5D) / (double)b0;
double d1 = (double)y + ((double)j1 + 0.5D) / (double)b0;
double d2 = (double)z + ((double)k1 + 0.5D) / (double)b0;
effectRenderer.addEffect((new EntityDiggingFX(world, d0, d1, d2, d0 - (double)x - 0.5D, d1 - (double)y - 0.5D, d2 - (double)z - 0.5D, tileAdaptable.getBlockForTexture(), tileAdaptable.getBlockMetadataForTexture())).applyColourMultiplier(x, y, z));
}
}
}
return true;
}
}
}
return super.addDestroyEffects(world, x, y, z, meta, effectRenderer);
}
示例14: addBlockDestroyEffects
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public static boolean addBlockDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer, Block block, int metadata, int side) {
byte size = 4;
for(int i = 0; i < size; i++) {
for(int j = 0; j < size; j++) {
for(int k = 0; k < size; k++) {
double xx = (double) x + ((double) i + 0.5D) / (double) size;
double yy = (double) y + ((double) j + 0.5D) / (double) size;
double zz = (double) z + ((double) k + 0.5D) / (double) size;
effectRenderer.addEffect((new EntityDiggingFX(world, xx, yy, zz, xx - (double) x - 0.5D, yy - (double) y - 0.5D, zz - (double) z - 0.5D, block, metadata, side)).applyColourMultiplier(x, y, z));
}
}
}
return true;
}
示例15: addBlockHitEffects
import net.minecraft.client.particle.EffectRenderer; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public static boolean addBlockHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer, int metadata, int side) {
int x = target.blockX;
int y = target.blockY;
int z = target.blockZ;
int sideHit = target.sideHit;
Block block = world.getBlock(x, y, z);
float f = 0.1F;
double xx = (double) x + world.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinX();
double yy = (double) y + world.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinY();
double zz = (double) z + world.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (double) (f * 2.0F)) + (double) f + block.getBlockBoundsMinZ();
if(sideHit == 0) {
yy = (double) y + block.getBlockBoundsMinY() - (double) f;
}
if(sideHit == 1) {
yy = (double) y + block.getBlockBoundsMaxY() + (double) f;
}
if(sideHit == 2) {
zz = (double) z + block.getBlockBoundsMinZ() - (double) f;
}
if(sideHit == 3) {
zz = (double) z + block.getBlockBoundsMaxZ() + (double) f;
}
if(sideHit == 4) {
xx = (double) x + block.getBlockBoundsMinX() - (double) f;
}
if(sideHit == 5) {
xx = (double) x + block.getBlockBoundsMaxX() + (double) f;
}
effectRenderer.addEffect((new EntityDiggingFX(world, xx, yy, zz, 0.0D, 0.0D, 0.0D, block, metadata, side)).applyColourMultiplier(x, y, z).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
return true;
}