-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEffectRenderer.java
More file actions
196 lines (174 loc) · 5.99 KB
/
EffectRenderer.java
File metadata and controls
196 lines (174 loc) · 5.99 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
import java.util.*;
import org.lwjgl.opengl.GL11;
public class EffectRenderer
{
public EffectRenderer(World world, RenderEngine renderengine)
{
fxLayers = new List[4];
rand = new Random();
if(world != null)
{
worldObj = world;
}
renderer = renderengine;
for(int i = 0; i < 4; i++)
{
fxLayers[i] = new ArrayList();
}
}
public void addEffect(EntityFX entityfx)
{
int i = entityfx.getFXLayer();
fxLayers[i].add(entityfx);
}
public void renderEffects()
{
for(int i = 0; i < 4; i++)
{
for(int j = 0; j < fxLayers[i].size(); j++)
{
EntityFX entityfx = (EntityFX)fxLayers[i].get(j);
entityfx.onUpdate();
if(entityfx.isDead)
{
fxLayers[i].remove(j--);
}
}
}
}
public void func_1189_a(Entity entity, float f)
{
float f1 = MathHelper.cos((entity.rotationYaw * 3.141593F) / 180F);
float f2 = MathHelper.sin((entity.rotationYaw * 3.141593F) / 180F);
float f3 = -f2 * MathHelper.sin((entity.rotationPitch * 3.141593F) / 180F);
float f4 = f1 * MathHelper.sin((entity.rotationPitch * 3.141593F) / 180F);
float f5 = MathHelper.cos((entity.rotationPitch * 3.141593F) / 180F);
EntityFX.interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)f;
EntityFX.interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)f;
EntityFX.interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)f;
for(int i = 0; i < 3; i++)
{
if(fxLayers[i].size() == 0)
{
continue;
}
int j = 0;
if(i == 0)
{
j = renderer.getTexture("/particles.png");
}
if(i == 1)
{
j = renderer.getTexture("/terrain.png");
}
if(i == 2)
{
j = renderer.getTexture("/gui/items.png");
}
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, j);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
for(int k = 0; k < fxLayers[i].size(); k++)
{
EntityFX entityfx = (EntityFX)fxLayers[i].get(k);
entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
}
tessellator.draw();
}
}
public void func_1187_b(Entity entity, float f)
{
byte byte0 = 3;
if(fxLayers[byte0].size() == 0)
{
return;
}
Tessellator tessellator = Tessellator.instance;
for(int i = 0; i < fxLayers[byte0].size(); i++)
{
EntityFX entityfx = (EntityFX)fxLayers[byte0].get(i);
entityfx.renderParticle(tessellator, f, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
}
}
public void func_1188_a(World world)
{
worldObj = world;
for(int i = 0; i < 4; i++)
{
fxLayers[i].clear();
}
}
public void func_1186_a(int i, int j, int k)
{
int l = worldObj.getBlockId(i, j, k);
if(l == 0)
{
return;
}
Block block = Block.blocksList[l];
int i1 = 4;
for(int j1 = 0; j1 < i1; j1++)
{
for(int k1 = 0; k1 < i1; k1++)
{
for(int l1 = 0; l1 < i1; l1++)
{
double d = (double)i + ((double)j1 + 0.5D) / (double)i1;
double d1 = (double)j + ((double)k1 + 0.5D) / (double)i1;
double d2 = (double)k + ((double)l1 + 0.5D) / (double)i1;
addEffect((new EntityDiggingFX(worldObj, d, d1, d2, d - (double)i - 0.5D, d1 - (double)j - 0.5D, d2 - (double)k - 0.5D, block)).func_4041_a(i, j, k));
}
}
}
}
public void func_1191_a(int i, int j, int k, int l)
{
int i1 = worldObj.getBlockId(i, j, k);
if(i1 == 0)
{
return;
}
Block block = Block.blocksList[i1];
float f = 0.1F;
double d = (double)i + rand.nextDouble() * (block.maxX - block.minX - (double)(f * 2.0F)) + (double)f + block.minX;
double d1 = (double)j + rand.nextDouble() * (block.maxY - block.minY - (double)(f * 2.0F)) + (double)f + block.minY;
double d2 = (double)k + rand.nextDouble() * (block.maxZ - block.minZ - (double)(f * 2.0F)) + (double)f + block.minZ;
if(l == 0)
{
d1 = ((double)j + block.minY) - (double)f;
}
if(l == 1)
{
d1 = (double)j + block.maxY + (double)f;
}
if(l == 2)
{
d2 = ((double)k + block.minZ) - (double)f;
}
if(l == 3)
{
d2 = (double)k + block.maxZ + (double)f;
}
if(l == 4)
{
d = ((double)i + block.minX) - (double)f;
}
if(l == 5)
{
d = (double)i + block.maxX + (double)f;
}
addEffect((new EntityDiggingFX(worldObj, d, d1, d2, 0.0D, 0.0D, 0.0D, block)).func_4041_a(i, j, k).func_407_b(0.2F).func_405_d(0.6F));
}
public String getStatistics()
{
return (new StringBuilder()).append("").append(fxLayers[0].size() + fxLayers[1].size() + fxLayers[2].size()).toString();
}
protected World worldObj;
private List fxLayers[];
private RenderEngine renderer;
private Random rand;
}