mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 11:59:25 +00:00
New hook to truely seperate the display of the 'durability' bar from the current / max durability. Allowing modders to control that display easier.
This commit is contained in:
1 parent
aa0c902d22
commit
b0bfea4e03
2 files changed
+54
-13
No files matched your search
@@ -177,7 +177,7 @@
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
@@ -462,8 +508,19 @@
|
||||
@@ -462,13 +508,25 @@
|
||||
GL11.glColor4f(f3, f4, f, 1.0F);
|
||||
}
|
||||
|
||||
@@ -197,7 +197,13 @@
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
@@ -477,7 +534,10 @@
|
||||
}
|
||||
|
||||
+ @SuppressWarnings("unused")
|
||||
public void func_82406_b(FontRenderer p_82406_1_, TextureManager p_82406_2_, final ItemStack p_82406_3_, int p_82406_4_, int p_82406_5_)
|
||||
{
|
||||
if (p_82406_3_ != null)
|
||||
@@ -477,7 +535,10 @@
|
||||
|
||||
try
|
||||
{
|
||||
@@ -209,7 +215,7 @@
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
@@ -518,7 +578,8 @@
|
||||
@@ -518,7 +579,8 @@
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
|
||||
@@ -219,7 +225,7 @@
|
||||
{
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
@@ -538,6 +599,23 @@
|
||||
@@ -538,6 +600,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +249,22 @@
|
||||
private void func_77018_a(int p_77018_1_, int p_77018_2_, int p_77018_3_, int p_77018_4_, int p_77018_5_)
|
||||
{
|
||||
for (int j1 = 0; j1 < 2; ++j1)
|
||||
@@ -638,4 +716,42 @@
|
||||
@@ -584,10 +663,11 @@
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
- if (p_94148_3_.func_77951_h())
|
||||
+ if (p_94148_3_.func_77973_b().showDurabilityBar(p_94148_3_))
|
||||
{
|
||||
- int j1 = (int)Math.round(13.0D - (double)p_94148_3_.func_77952_i() * 13.0D / (double)p_94148_3_.func_77958_k());
|
||||
- int k = (int)Math.round(255.0D - (double)p_94148_3_.func_77952_i() * 255.0D / (double)p_94148_3_.func_77958_k());
|
||||
+ double health = p_94148_3_.func_77973_b().getDurabilityForDisplay(p_94148_3_);
|
||||
+ int j1 = (int)Math.round(13.0D - health * 13.0D);
|
||||
+ int k = (int)Math.round(255.0D - health * 255.0D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
@@ -638,4 +718,42 @@
|
||||
{
|
||||
this.func_76986_a((EntityItem)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
Vec3 vec31 = vec3.func_72441_c((double)f7 * d3, (double)f6 * d3, (double)f8 * d3);
|
||||
return p_77621_1_.func_147447_a(vec3, vec31, p_77621_3_, !p_77621_3_, false);
|
||||
}
|
||||
@@ -726,6 +743,542 @@
|
||||
@@ -726,6 +743,562 @@
|
||||
return this.field_111218_cA == null ? "MISSING_ICON_ITEM_" + field_150901_e.func_148757_b(this) + "_" + this.field_77774_bZ : this.field_111218_cA;
|
||||
}
|
||||
|
||||
@@ -517,15 +517,35 @@
|
||||
+ return stack.field_77991_e;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Return the itemDamage display value represented by this itemstack.
|
||||
+ * @param stack the stack
|
||||
+ * @return the damage value
|
||||
+ */
|
||||
+ @Deprecated // This isn't 'display' its normal Damage, the above function is 'Aux' data, but the same value.
|
||||
+ public int getDisplayDamage(ItemStack stack)
|
||||
+ {
|
||||
+ return stack.field_77991_e;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Determines if the durability bar should be rendered for this item.
|
||||
+ * Defaults to vanilla stack.isDamaged behavior.
|
||||
+ * But modders can use this for any data they wish.
|
||||
+ *
|
||||
+ * @param stack The current Item Stack
|
||||
+ * @return True if it should render the 'durability' bar.
|
||||
+ */
|
||||
+ public boolean showDurabilityBar(ItemStack stack)
|
||||
+ {
|
||||
+ return stack.func_77951_h();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Queries the percentage of the 'Durability' bar that should be drawn.
|
||||
+ *
|
||||
+ * @param stack The current ItemStack
|
||||
+ * @return 1.0 for 100% 0 for 0%
|
||||
+ */
|
||||
+ public double getDurabilityForDisplay(ItemStack stack)
|
||||
+ {
|
||||
+ return (double)stack.func_77952_i() / (double)stack.func_77958_k();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item,
|
||||
@@ -639,7 +659,7 @@
|
||||
public static enum ToolMaterial
|
||||
{
|
||||
WOOD(0, 59, 2.0F, 0.0F, 15),
|
||||
@@ -741,6 +1294,9 @@
|
||||
@@ -741,6 +1314,9 @@
|
||||
|
||||
private static final String __OBFID = "CL_00000042";
|
||||
|
||||
@@ -649,7 +669,7 @@
|
||||
private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_)
|
||||
{
|
||||
this.field_78001_f = p_i1874_3_;
|
||||
@@ -777,7 +1333,15 @@
|
||||
@@ -777,7 +1353,15 @@
|
||||
|
||||
public Item func_150995_f()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user