-
Notifications
You must be signed in to change notification settings - Fork 1
/
ModPotionStatus.java
110 lines (94 loc) · 4.65 KB
/
ModPotionStatus.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
98
99
100
101
102
103
104
105
106
107
108
109
110
package shaderclient.mods.impl;
import java.util.Collection;
import org.lwjgl.opengl.GL11;
import shaderclient.gui.hud.ScreenPosition;
import shaderclient.mods.ModDraggable;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.InventoryEffectRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation;
public class ModPotionStatus extends ModDraggable {
private ScreenPosition pos = ScreenPosition.fromRelativePosition(0.5, 0.5);
protected FontRenderer fontRendererObj;
protected float zLevelFloat;
@Override
public int getWidth() {
return 101;
}
@Override
public int getHeight() {
return 154;
}
public void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height)
{
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos((double)(x + 0), (double)(y + height), (double)this.zLevelFloat).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + height), (double)this.zLevelFloat).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + 0), (double)this.zLevelFloat).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
worldrenderer.pos((double)(x + 0), (double)(y + 0), (double)this.zLevelFloat).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
tessellator.draw();
}
@Override
public void render(ScreenPosition pos) {
int offsetX = 21;
int offsetY = 14;
int i = 80;
int i2 = 16;
Collection<PotionEffect> collection = this.mc.thePlayer.getActivePotionEffects();
if (!collection.isEmpty())
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
int l = 33;
if (collection.size() > 5)
{
l = 132 / (collection.size() - 1);
}
for (PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects())
{
Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (potion.hasStatusIcon())
{
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/inventory.png"));
int i1 = potion.getStatusIconIndex();
drawTexturedModalRect((pos.getAbsoluteX() + offsetX) - 20, (pos.getAbsoluteY() + i2) - offsetY, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18);
}
String s1 = I18n.format(potion.getName(), new Object[0]);
if (potioneffect.getAmplifier() == 1)
{
s1 = s1 + " " + I18n.format("enchantment.level.2", new Object[0]);
}
else if (potioneffect.getAmplifier() == 2)
{
s1 = s1 + " " + I18n.format("enchantment.level.3", new Object[0]);
}
else if (potioneffect.getAmplifier() == 3)
{
s1 = s1 + " " + I18n.format("enchantment.level.4", new Object[0]);
}
font.drawString(s1, pos.getAbsoluteX() + offsetX, (pos.getAbsoluteY() + i2) - offsetY, 16777215, true);
String s = Potion.getDurationString(potioneffect);
font.drawString(s, pos.getAbsoluteX() + offsetX, (pos.getAbsoluteY() + i2 + 10) - offsetY, 8355711, true);
i2 += l;
}
}
}
public void renderDummy(ScreenPosition pos) {
font.drawString("İksir Efektleri", pos.getAbsoluteX(), pos.getAbsoluteY(), -1);
}
}