Let ItemGroup provide it's own tabs image resource location (#5330)
This commit is contained in:
parent
f87dca2ad4
commit
39965c55ac
2 changed files with 18 additions and 6 deletions
|
@ -187,19 +187,20 @@
|
||||||
} else {
|
} else {
|
||||||
super.func_146285_a(p_146285_1_, p_146285_2_, p_146285_3_);
|
super.func_146285_a(p_146285_1_, p_146285_2_, p_146285_3_);
|
||||||
}
|
}
|
||||||
@@ -575,14 +647,30 @@
|
@@ -575,25 +647,44 @@
|
||||||
RenderHelper.func_74520_c();
|
RenderHelper.func_74520_c();
|
||||||
ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w];
|
ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w];
|
||||||
|
|
||||||
- for(ItemGroup itemgroup1 : ItemGroup.field_78032_a) {
|
- for(ItemGroup itemgroup1 : ItemGroup.field_78032_a) {
|
||||||
|
- this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
|
||||||
+ int start = tabPage * 10;
|
+ int start = tabPage * 10;
|
||||||
+ int end = Math.min(ItemGroup.field_78032_a.length, ((tabPage + 1) * 10 + 2));
|
+ int end = Math.min(ItemGroup.field_78032_a.length, ((tabPage + 1) * 10 + 2));
|
||||||
+ if (tabPage != 0) start += 2;
|
+ if (tabPage != 0) start += 2;
|
||||||
+
|
+
|
||||||
+ for(ItemGroup itemgroup1 : java.util.Arrays.copyOfRange(ItemGroup.field_78032_a, start, end)) {
|
+ for(ItemGroup itemgroup1 : java.util.Arrays.copyOfRange(ItemGroup.field_78032_a, start, end)) {
|
||||||
this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
|
|
||||||
+ if (itemgroup1 == null) continue;
|
+ if (itemgroup1 == null) continue;
|
||||||
if (itemgroup1.func_78021_a() != field_147058_w) {
|
if (itemgroup1.func_78021_a() != field_147058_w) {
|
||||||
|
+ this.field_146297_k.func_110434_K().func_110577_a(itemgroup1.getTabsImage());
|
||||||
this.func_147051_a(itemgroup1);
|
this.func_147051_a(itemgroup1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,11 +208,11 @@
|
||||||
- this.field_146297_k.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + itemgroup.func_78015_f()));
|
- this.field_146297_k.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + itemgroup.func_78015_f()));
|
||||||
+ if (tabPage != 0) {
|
+ if (tabPage != 0) {
|
||||||
+ if (itemgroup != ItemGroup.field_78027_g) {
|
+ if (itemgroup != ItemGroup.field_78027_g) {
|
||||||
+ this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
|
+ this.field_146297_k.func_110434_K().func_110577_a(ItemGroup.field_78027_g.getTabsImage());
|
||||||
+ func_147051_a(ItemGroup.field_78027_g);
|
+ func_147051_a(ItemGroup.field_78027_g);
|
||||||
+ }
|
+ }
|
||||||
+ if (itemgroup != ItemGroup.field_78036_m) {
|
+ if (itemgroup != ItemGroup.field_78036_m) {
|
||||||
+ this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
|
+ this.field_146297_k.func_110434_K().func_110577_a(ItemGroup.field_78036_m.getTabsImage());
|
||||||
+ func_147051_a(ItemGroup.field_78036_m);
|
+ func_147051_a(ItemGroup.field_78036_m);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
@ -220,7 +221,12 @@
|
||||||
this.func_73729_b(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g);
|
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_);
|
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);
|
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
@@ -594,6 +682,9 @@
|
int i = this.field_147003_i + 175;
|
||||||
|
int j = this.field_147009_r + 18;
|
||||||
|
int k = j + 112;
|
||||||
|
- this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
|
||||||
|
+ this.field_146297_k.func_110434_K().func_110577_a(itemgroup.getTabsImage());
|
||||||
|
if (itemgroup.func_78017_i()) {
|
||||||
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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
return this.field_78033_n < 6;
|
return this.field_78033_n < 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,4 +225,52 @@
|
@@ -220,4 +225,58 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,12 @@
|
||||||
+ return new net.minecraft.util.ResourceLocation("textures/gui/container/creative_inventory/tab_" + this.func_78015_f());
|
+ return new net.minecraft.util.ResourceLocation("textures/gui/container/creative_inventory/tab_" + this.func_78015_f());
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ private static final net.minecraft.util.ResourceLocation CREATIVE_INVENTORY_TABS = new net.minecraft.util.ResourceLocation("textures/gui/container/creative_inventory/tabs.png");
|
||||||
|
+ @OnlyIn(Dist.CLIENT)
|
||||||
|
+ public net.minecraft.util.ResourceLocation getTabsImage() {
|
||||||
|
+ return CREATIVE_INVENTORY_TABS;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ public int getLabelColor() {
|
+ public int getLabelColor() {
|
||||||
+ return 4210752;
|
+ return 4210752;
|
||||||
+ }
|
+ }
|
||||||
|
|
Loading…
Reference in a new issue