257 lines
11 KiB
Diff
257 lines
11 KiB
Diff
--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java
|
|
+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java
|
|
@@ -50,6 +50,8 @@
|
|
private Slot field_147064_C;
|
|
private boolean field_147057_D;
|
|
private CreativeCrafting field_147059_E;
|
|
+ private static int tabPage = 0;
|
|
+ private int maxPages = 0;
|
|
|
|
public GuiContainerCreative(EntityPlayer p_i1088_1_)
|
|
{
|
|
@@ -259,6 +261,13 @@
|
|
this.func_147050_b(CreativeTabs.field_78032_a[i]);
|
|
this.field_147059_E = new CreativeCrafting(this.field_146297_k);
|
|
this.field_146297_k.field_71439_g.field_71069_bz.func_75132_a(this.field_147059_E);
|
|
+ int tabCount = CreativeTabs.field_78032_a.length;
|
|
+ if (tabCount > 12)
|
|
+ {
|
|
+ field_146292_n.add(new GuiButton(101, field_147003_i, field_147009_r - 50, 20, 20, "<"));
|
|
+ field_146292_n.add(new GuiButton(102, field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, ">"));
|
|
+ maxPages = ((tabCount - 12) / 10) + 1;
|
|
+ }
|
|
}
|
|
else
|
|
{
|
|
@@ -280,7 +289,7 @@
|
|
|
|
protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException
|
|
{
|
|
- if (field_147058_w != CreativeTabs.field_78027_g.func_78021_a())
|
|
+ if (!CreativeTabs.field_78032_a[field_147058_w].hasSearchBar())
|
|
{
|
|
if (GameSettings.func_100015_a(this.field_146297_k.field_71474_y.field_74310_D))
|
|
{
|
|
@@ -318,6 +327,14 @@
|
|
GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h;
|
|
guicontainercreative$containercreative.field_148330_a.clear();
|
|
|
|
+ CreativeTabs tab = CreativeTabs.field_78032_a[field_147058_w];
|
|
+ if (tab.hasSearchBar() && tab != CreativeTabs.field_78027_g)
|
|
+ {
|
|
+ tab.func_78018_a(guicontainercreative$containercreative.field_148330_a);
|
|
+ updateFilteredItems(guicontainercreative$containercreative);
|
|
+ return;
|
|
+ }
|
|
+
|
|
for (Item item : Item.field_150901_e)
|
|
{
|
|
if (item != null && item.func_77640_w() != null)
|
|
@@ -325,7 +342,13 @@
|
|
item.func_150895_a(item, (CreativeTabs)null, guicontainercreative$containercreative.field_148330_a);
|
|
}
|
|
}
|
|
+ updateFilteredItems(guicontainercreative$containercreative);
|
|
+ }
|
|
|
|
+ //split from above for custom search tabs
|
|
+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative)
|
|
+ {
|
|
+ if (CreativeTabs.field_78032_a[field_147058_w] == CreativeTabs.field_78027_g) // FORGE: Only add enchanted books to the regular search
|
|
for (Enchantment enchantment : Enchantment.field_185264_b)
|
|
{
|
|
if (enchantment != null && enchantment.field_77351_y != null)
|
|
@@ -333,7 +356,6 @@
|
|
Items.field_151134_bR.func_92113_a(enchantment, guicontainercreative$containercreative.field_148330_a);
|
|
}
|
|
}
|
|
-
|
|
Iterator<ItemStack> iterator = guicontainercreative$containercreative.field_148330_a.iterator();
|
|
String s1 = this.field_147062_A.func_146179_b().toLowerCase();
|
|
|
|
@@ -365,7 +387,7 @@
|
|
{
|
|
CreativeTabs creativetabs = CreativeTabs.field_78032_a[field_147058_w];
|
|
|
|
- if (creativetabs.func_78019_g())
|
|
+ if (creativetabs != null && creativetabs.func_78019_g())
|
|
{
|
|
GlStateManager.func_179084_k();
|
|
this.field_146289_q.func_78276_b(I18n.func_135052_a(creativetabs.func_78024_c(), new Object[0]), 8, 6, 4210752);
|
|
@@ -400,7 +422,7 @@
|
|
|
|
for (CreativeTabs creativetabs : CreativeTabs.field_78032_a)
|
|
{
|
|
- if (this.func_147049_a(creativetabs, i, j))
|
|
+ if (creativetabs != null && this.func_147049_a(creativetabs, i, j))
|
|
{
|
|
this.func_147050_b(creativetabs);
|
|
return;
|
|
@@ -413,11 +435,13 @@
|
|
|
|
private boolean func_147055_p()
|
|
{
|
|
+ if (CreativeTabs.field_78032_a[field_147058_w] == null) return false;
|
|
return field_147058_w != CreativeTabs.field_78036_m.func_78021_a() && CreativeTabs.field_78032_a[field_147058_w].func_78017_i() && ((GuiContainerCreative.ContainerCreative)this.field_147002_h).func_148328_e();
|
|
}
|
|
|
|
private void func_147050_b(CreativeTabs p_147050_1_)
|
|
{
|
|
+ if (p_147050_1_ == null) return;
|
|
int i = field_147058_w;
|
|
field_147058_w = p_147050_1_.func_78021_a();
|
|
GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h;
|
|
@@ -488,12 +512,14 @@
|
|
|
|
if (this.field_147062_A != null)
|
|
{
|
|
- if (p_147050_1_ == CreativeTabs.field_78027_g)
|
|
+ if (p_147050_1_.hasSearchBar())
|
|
{
|
|
this.field_147062_A.func_146189_e(true);
|
|
this.field_147062_A.func_146205_d(false);
|
|
this.field_147062_A.func_146195_b(true);
|
|
this.field_147062_A.func_146180_a("");
|
|
+ this.field_147062_A.field_146218_h = p_147050_1_.getSearchbarWidth();
|
|
+ this.field_147062_A.field_146209_f = this.field_147003_i + (82 /*default left*/ + 89 /*default width*/) - this.field_147062_A.field_146218_h;
|
|
this.func_147053_i();
|
|
}
|
|
else
|
|
@@ -563,20 +589,43 @@
|
|
}
|
|
|
|
super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
|
|
+ int start = tabPage * 10;
|
|
+ int end = Math.min(CreativeTabs.field_78032_a.length, ((tabPage + 1) * 10) + 2);
|
|
+ if (tabPage != 0) start += 2;
|
|
+ boolean rendered = false;
|
|
|
|
- for (CreativeTabs creativetabs : CreativeTabs.field_78032_a)
|
|
+ for (CreativeTabs creativetabs : java.util.Arrays.copyOfRange(CreativeTabs.field_78032_a,start,end))
|
|
{
|
|
+ if (creativetabs == null) continue;
|
|
if (this.func_147052_b(creativetabs, p_73863_1_, p_73863_2_))
|
|
{
|
|
+ rendered = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+ if (!rendered && func_147052_b(CreativeTabs.field_78027_g, p_73863_1_, p_73863_2_))
|
|
+ {
|
|
+ func_147052_b(CreativeTabs.field_78036_m, p_73863_1_, p_73863_2_);
|
|
+ }
|
|
+
|
|
if (this.field_147064_C != null && field_147058_w == CreativeTabs.field_78036_m.func_78021_a() && this.func_146978_c(this.field_147064_C.field_75223_e, this.field_147064_C.field_75221_f, 16, 16, p_73863_1_, p_73863_2_))
|
|
{
|
|
this.func_146279_a(I18n.func_135052_a("inventory.binSlot", new Object[0]), p_73863_1_, p_73863_2_);
|
|
}
|
|
|
|
+ if (maxPages != 0)
|
|
+ {
|
|
+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1);
|
|
+ int width = field_146289_q.func_78256_a(page);
|
|
+ GlStateManager.func_179140_f();
|
|
+ this.field_73735_i = 300.0F;
|
|
+ field_146296_j.field_77023_b = 300.0F;
|
|
+ field_146289_q.func_78276_b(page, field_147003_i + (field_146999_f / 2) - (width / 2), field_147009_r - 44, -1);
|
|
+ this.field_73735_i = 0.0F;
|
|
+ field_146296_j.field_77023_b = 0.0F;
|
|
+ }
|
|
+
|
|
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
|
|
GlStateManager.func_179140_f();
|
|
}
|
|
@@ -638,16 +687,35 @@
|
|
RenderHelper.func_74520_c();
|
|
CreativeTabs creativetabs = CreativeTabs.field_78032_a[field_147058_w];
|
|
|
|
- for (CreativeTabs creativetabs1 : CreativeTabs.field_78032_a)
|
|
+ int start = tabPage * 10;
|
|
+ int end = Math.min(CreativeTabs.field_78032_a.length, ((tabPage + 1) * 10 + 2));
|
|
+ if (tabPage != 0) start += 2;
|
|
+
|
|
+ for (CreativeTabs creativetabs1 : java.util.Arrays.copyOfRange(CreativeTabs.field_78032_a,start,end))
|
|
{
|
|
this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
|
|
|
|
+ if (creativetabs1 == null) continue;
|
|
if (creativetabs1.func_78021_a() != field_147058_w)
|
|
{
|
|
this.func_147051_a(creativetabs1);
|
|
}
|
|
}
|
|
|
|
+ if (tabPage != 0)
|
|
+ {
|
|
+ if (creativetabs != CreativeTabs.field_78027_g)
|
|
+ {
|
|
+ this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
|
|
+ func_147051_a(CreativeTabs.field_78027_g);
|
|
+ }
|
|
+ if (creativetabs != CreativeTabs.field_78036_m)
|
|
+ {
|
|
+ this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
|
|
+ func_147051_a(CreativeTabs.field_78036_m);
|
|
+ }
|
|
+ }
|
|
+
|
|
this.field_146297_k.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.func_78015_f()));
|
|
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_146194_f();
|
|
@@ -662,6 +730,14 @@
|
|
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);
|
|
}
|
|
|
|
+ if (creativetabs == null || creativetabs.getTabPage() != tabPage)
|
|
+ {
|
|
+ if (creativetabs != CreativeTabs.field_78027_g && creativetabs != CreativeTabs.field_78036_m)
|
|
+ {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+
|
|
this.func_147051_a(creativetabs);
|
|
|
|
if (creativetabs == CreativeTabs.field_78036_m)
|
|
@@ -672,6 +748,14 @@
|
|
|
|
protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_)
|
|
{
|
|
+ if (p_147049_1_.getTabPage() != tabPage)
|
|
+ {
|
|
+ if (p_147049_1_ != CreativeTabs.field_78027_g && p_147049_1_ != CreativeTabs.field_78036_m)
|
|
+ {
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+
|
|
int i = p_147049_1_.func_78020_k();
|
|
int j = 28 * i;
|
|
int k = 0;
|
|
@@ -768,6 +852,8 @@
|
|
}
|
|
|
|
GlStateManager.func_179140_f();
|
|
+ GlStateManager.func_179124_c(1F, 1F, 1F); //Forge: Reset color in case Items change it.
|
|
+ GlStateManager.func_179147_l(); //Forge: Make sure blend is enabled else tabs show a white border.
|
|
this.func_73729_b(l, i1, j, k, 28, j1);
|
|
this.field_73735_i = 100.0F;
|
|
this.field_146296_j.field_77023_b = 100.0F;
|
|
@@ -794,6 +880,15 @@
|
|
{
|
|
this.field_146297_k.func_147108_a(new GuiStats(this, this.field_146297_k.field_71439_g.func_146107_m()));
|
|
}
|
|
+
|
|
+ if (p_146284_1_.field_146127_k == 101)
|
|
+ {
|
|
+ tabPage = Math.max(tabPage - 1, 0);
|
|
+ }
|
|
+ else if (p_146284_1_.field_146127_k == 102)
|
|
+ {
|
|
+ tabPage = Math.min(tabPage + 1, maxPages);
|
|
+ }
|
|
}
|
|
|
|
public int func_147056_g()
|