Add getHighlightTip allowing a item to override its displayed renderToolHightlight.

This commit is contained in:
AlgorithmX2 2015-12-13 04:47:25 -06:00
parent 2ed4f39a13
commit 8db720151d
2 changed files with 18 additions and 3 deletions

View file

@ -57,7 +57,7 @@
Vec3 vec31 = vec3.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); Vec3 vec31 = vec3.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
return p_77621_1_.func_147447_a(vec3, vec31, p_77621_3_, !p_77621_3_, false); return p_77621_1_.func_147447_a(vec3, vec31, p_77621_3_, !p_77621_3_, false);
} }
@@ -371,11 +380,578 @@ @@ -371,11 +380,591 @@
return false; return false;
} }
@ -91,6 +91,19 @@
+ } + }
+ +
+ /** + /**
+ * Allow the item one last chance to modify its name used for the
+ * tool highlight useful for adding something extra that can't be removed
+ * by a user in the displayed name, such as a mode of operation.
+ *
+ * @param item the ItemStack for the item.
+ * @param the name that will be displayed unless it is changed in this method.
+ */
+ public String getHighlightTip( ItemStack item, String displayName )
+ {
+ return displayName;
+ }
+
+ /**
+ * This is called when the item is used, before the block is activated. + * This is called when the item is used, before the block is activated.
+ * @param stack The Item Stack + * @param stack The Item Stack
+ * @param player The Player that used the item + * @param player The Player that used the item
@ -636,7 +649,7 @@
public static void func_150900_l() public static void func_150900_l()
{ {
func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function<ItemStack, String>() func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function<ItemStack, String>()
@@ -855,6 +1431,10 @@ @@ -855,6 +1444,10 @@
private final float field_78011_i; private final float field_78011_i;
private final int field_78008_j; private final int field_78008_j;
@ -647,7 +660,7 @@
private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_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_; this.field_78001_f = p_i1874_3_;
@@ -889,9 +1469,36 @@ @@ -889,9 +1482,36 @@
return this.field_78008_j; return this.field_78008_j;
} }

View file

@ -597,6 +597,8 @@ public class GuiIngameForge extends GuiIngame
if (this.highlightingItemStack.hasDisplayName()) if (this.highlightingItemStack.hasDisplayName())
name = EnumChatFormatting.ITALIC + name; name = EnumChatFormatting.ITALIC + name;
name = this.highlightingItemStack.getItem().getHighlightTip(this.highlightingItemStack, name);
int opacity = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F); int opacity = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F);
if (opacity > 255) opacity = 255; if (opacity > 255) opacity = 255;