Allow GuiContainer and ItemGroup to specify slot hover colors (#5332)

This commit is contained in:
Merlin Addams 2019-02-06 23:29:12 +00:00 committed by LexManos
parent 3e02903d19
commit f87dca2ad4
3 changed files with 41 additions and 11 deletions

View file

@ -1,5 +1,23 @@
--- a/net/minecraft/client/gui/inventory/GuiContainer.java
+++ b/net/minecraft/client/gui/inventory/GuiContainer.java
@@ -7,7 +7,6 @@
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
-import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
@@ -97,7 +96,8 @@
int j1 = slot.field_75223_e;
int k1 = slot.field_75221_f;
GlStateManager.func_179135_a(true, true, true, false);
- this.func_73733_a(j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433);
+ int slotColor = this.getSlotColor(i1);
+ this.func_73733_a(j1, k1, j1 + 16, k1 + 16, slotColor, slotColor);
GlStateManager.func_179135_a(true, true, true, true);
GlStateManager.func_179145_e();
GlStateManager.func_179126_j();
@@ -107,6 +107,7 @@
RenderHelper.func_74518_a();
this.func_146979_b(p_73863_1_, p_73863_2_);
@ -131,7 +149,7 @@
this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, i, ClickType.SWAP);
return true;
}
@@ -556,4 +563,11 @@
@@ -556,4 +563,16 @@
}
}
@ -142,4 +160,9 @@
+ public int getGuiTop() { return field_147009_r; }
+ public int getXSize() { return field_146999_f; }
+ public int getYSize() { return field_147000_g; }
+
+ public int slotColor = -2130706433;
+ public int getSlotColor(int index) {
+ return slotColor;
+ }
}

View file

@ -104,7 +104,7 @@
this.func_147050_b(itemgroup);
return true;
}
@@ -368,10 +412,12 @@
@@ -368,12 +412,15 @@
}
private boolean func_147055_p() {
@ -116,8 +116,11 @@
+ if (p_147050_1_ == null) return;
int i = field_147058_w;
field_147058_w = p_147050_1_.func_78021_a();
+ slotColor = p_147050_1_.getSlotColor();
GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h;
@@ -447,13 +493,15 @@
this.field_147008_s.clear();
guicontainercreative$containercreative.field_148330_a.clear();
@@ -447,13 +494,15 @@
}
if (this.field_147062_A != null) {
@ -134,7 +137,7 @@
this.func_147053_i();
} else {
@@ -512,16 +560,36 @@
@@ -512,16 +561,36 @@
this.func_146276_q_();
super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
@ -172,7 +175,7 @@
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.func_179140_f();
this.func_191948_b(p_73863_1_, p_73863_2_);
@@ -563,7 +631,10 @@
@@ -563,7 +632,10 @@
}
}
@ -184,7 +187,7 @@
} else {
super.func_146285_a(p_146285_1_, p_146285_2_, p_146285_3_);
}
@@ -575,14 +646,30 @@
@@ -575,14 +647,30 @@
RenderHelper.func_74520_c();
ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w];
@ -217,7 +220,7 @@
this.func_73729_b(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g);
this.field_147062_A.func_195608_a(p_146976_2_, p_146976_3_, p_146976_1_);
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
@@ -594,6 +681,9 @@
@@ -594,6 +682,9 @@
this.func_73729_b(i, j + (int)((float)(k - j - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15);
}
@ -227,7 +230,7 @@
this.func_147051_a(itemgroup);
if (itemgroup == ItemGroup.field_78036_m) {
GuiInventory.func_147046_a(this.field_147003_i + 88, this.field_147009_r + 45, 20, (float)(this.field_147003_i + 88 - p_146976_2_), (float)(this.field_147009_r + 45 - 30 - p_146976_3_), this.field_146297_k.field_71439_g);
@@ -602,6 +692,7 @@
@@ -602,6 +693,7 @@
}
protected boolean func_195375_a(ItemGroup p_195375_1_, double p_195375_2_, double p_195375_4_) {
@ -235,7 +238,7 @@
int i = p_195375_1_.func_78020_k();
int j = 28 * i;
int k = 0;
@@ -671,6 +762,8 @@
@@ -671,6 +763,8 @@
}
GlStateManager.func_179140_f();
@ -244,7 +247,7 @@
this.func_73729_b(l, i1, j, k, 28, 32);
this.field_73735_i = 100.0F;
this.field_146296_j.field_77023_b = 100.0F;
@@ -845,6 +938,31 @@
@@ -845,6 +939,31 @@
public boolean func_82869_a(EntityPlayer p_82869_1_) {
return this.field_148332_b.func_82869_a(p_82869_1_);
}

View file

@ -40,7 +40,7 @@
return this.field_78033_n < 6;
}
@@ -220,4 +225,48 @@
@@ -220,4 +225,52 @@
}
}
@ -72,6 +72,10 @@
+ return 4210752;
+ }
+
+ public int getSlotColor() {
+ return -2130706433;
+ }
+
+ public static synchronized int getGroupCountSafe() {
+ return ItemGroup.field_78032_a.length;
+ }