-
Notifications
You must be signed in to change notification settings - Fork 497
/
EntityRobotEnergyFX.java
executable file
·97 lines (82 loc) · 2.56 KB
/
EntityRobotEnergyFX.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.robots;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class EntityRobotEnergyFX extends EntityFX {
private float smokeParticleScale;
public EntityRobotEnergyFX(World world, double x, double y, double z,
double vx,
double vy, double vz) {
this(world, x, y, z, vx, vy, vz, 1.0F);
}
public EntityRobotEnergyFX(World world, double x, double y, double z,
double vx,
double vy, double vz, float size) {
super(world, x, y, z, vx, vy, vz);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += vx;
this.motionY += vy;
this.motionZ += vz;
this.particleRed = (float) (Math.random() * 0.6);
this.particleGreen = 0;
this.particleBlue = 0;
this.particleScale *= 0.75F;
this.particleScale *= size;
this.smokeParticleScale = this.particleScale;
this.particleMaxAge = (int) (16.0D / (Math.random() * 0.8D + 0.2D));
this.particleMaxAge = (int) (this.particleMaxAge * size);
this.noClip = false;
}
@Override
public void renderParticle(Tessellator tesslator, float p2, float p3, float p4,
float p5, float p6, float p7) {
float f6 = (this.particleAge + p2) / this.particleMaxAge * 32.0F;
if (f6 < 0.0F) {
f6 = 0.0F;
}
if (f6 > 1.0F) {
f6 = 1.0F;
}
this.particleScale = this.smokeParticleScale * f6;
super.renderParticle(tesslator, p2, p3, p4, p5, p6, p7);
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge) {
this.setDead();
}
this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.posY == this.prevPosY) {
this.motionX *= 1.1D;
this.motionY = 0.001D;
this.motionZ *= 1.1D;
}
this.motionX *= 0.98;
this.motionY *= 0.98;
this.motionZ *= 0.98;
if (this.onGround) {
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
}