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
|
/*
* spotless:off
* KubaTech - Gregtech Addon
* Copyright (C) 2022 - 2024 kuba6000
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <https://www.gnu.org/licenses/>.
* spotless:on
*/
package kubatech.client.effect;
import static net.minecraft.client.renderer.entity.RenderManager.renderPosX;
import static net.minecraft.client.renderer.entity.RenderManager.renderPosY;
import static net.minecraft.client.renderer.entity.RenderManager.renderPosZ;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import kubatech.api.enums.ItemList;
public class MegaApiaryBeesRenderer extends EntityFX {
public MegaApiaryBeesRenderer(World world, double x, double y, double z, int age) {
super(world, x, y + 2, z);
this.particleMaxAge = age;
}
@Override
public void onUpdate() {
if (this.particleAge++ == this.particleMaxAge) this.setDead();
if (this.particleAge % 4 == 0) if (this.particleAge % 8 == 0) this.posY += 0.1;
else this.posY -= 0.1;
}
@Override
public boolean shouldRenderInPass(int pass) {
return pass == 3;
}
@Override
public int getFXLayer() {
return 3;
}
@Override
public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_,
float p_70539_5_, float p_70539_6_, float p_70539_7_) {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glPushMatrix();
GL11.glTranslatef(
(float) (this.posX - renderPosX),
(float) (this.posY - renderPosY),
(float) (this.posZ - renderPosZ));
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glRotatef(180f, 1f, 0f, 0f);
Minecraft.getMinecraft()
.getTextureManager()
.bindTexture(TextureMap.locationItemsTexture);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1f, 1f, 1f, 1F);
IIcon icon = ItemList.Beeeeee.get(1)
.getIconIndex();
GL11.glPushMatrix();
GL11.glTranslatef(0f, 0f, -4f);
GL11.glScalef(0.1f, 0.1f, 0.1f);
RenderItem.getInstance()
.renderIcon(0, 0, icon, 16, 16);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslatef(1f, 0f, 3f);
GL11.glRotatef(180f, 0f, 1f, 0f);
GL11.glScalef(0.1f, 0.1f, 0.1f);
RenderItem.getInstance()
.renderIcon(0, 0, icon, 16, 16);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslatef(4f, 0f, -1f);
GL11.glRotatef(-90f, 0f, 1f, 0f);
GL11.glScalef(0.1f, 0.1f, 0.1f);
RenderItem.getInstance()
.renderIcon(0, 0, icon, 16, 16);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslatef(-3f, 0f, 1f);
GL11.glRotatef(90f, 0f, 1f, 0f);
GL11.glScalef(0.1f, 0.1f, 0.1f);
RenderItem.getInstance()
.renderIcon(0, 0, icon, 16, 16);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}
|