22
22
import clashsoft .playerinventoryapi .lib .ButtonHashingStrategy ;
23
23
import clashsoft .playerinventoryapi .lib .ExtendedInventory ;
24
24
25
+ import net .minecraft .client .gui .FontRenderer ;
25
26
import net .minecraft .client .gui .GuiButton ;
26
27
import net .minecraft .client .gui .GuiTextField ;
27
28
import net .minecraft .client .gui .achievement .GuiAchievements ;
28
29
import net .minecraft .client .gui .achievement .GuiStats ;
29
30
import net .minecraft .client .gui .inventory .CreativeCrafting ;
31
+ import net .minecraft .client .gui .inventory .GuiInventory ;
30
32
import net .minecraft .client .renderer .RenderHelper ;
31
33
import net .minecraft .client .settings .GameSettings ;
32
34
import net .minecraft .creativetab .CreativeTabs ;
@@ -347,18 +349,27 @@ public void drawScreen(int mouseX, int mouseY, float partialTickTime)
347
349
}
348
350
349
351
super .drawScreen (mouseX , mouseY , partialTickTime );
350
- CreativeTabs [] acreativetabs = CreativeTabs .creativeTabArray ;
352
+
353
+ if (this .maxPages != 0 )
354
+ {
355
+ String page = String .format ("%d / %d" , new Object [] { Integer .valueOf (tabPage + 1 ), Integer .valueOf (this .maxPages + 1 ) });
356
+ int width = this .fontRendererObj .getStringWidth (page );
357
+ GL11 .glDisable (2896 );
358
+ this .fontRendererObj .drawString (page , this .guiLeft + (this .xSize - width ) / 2 , this .guiTop - 44 , -1 );
359
+ }
360
+
361
+ CreativeTabs [] tabs = CreativeTabs .creativeTabArray ;
351
362
int start = tabPage * 10 ;
352
- int len1 = Math .min (acreativetabs .length , start + 12 );
363
+ int end = Math .min (tabs .length , start + 12 );
353
364
if (tabPage != 0 )
354
365
{
355
366
start += 2 ;
356
367
}
357
368
boolean rendered = false ;
358
369
359
- for (int i = start ; i < len1 ; ++i )
370
+ for (int i = start ; i < end ; ++i )
360
371
{
361
- CreativeTabs tab = acreativetabs [i ];
372
+ CreativeTabs tab = tabs [i ];
362
373
String page ;
363
374
int width ;
364
375
if (tab != null )
@@ -371,26 +382,25 @@ public void drawScreen(int mouseX, int mouseY, float partialTickTime)
371
382
}
372
383
}
373
384
374
- if (!rendered && this . renderTabHoveringText ( CreativeTabs . tabAllSearch , mouseX , mouseY ) )
385
+ if (!rendered )
375
386
{
376
- this .renderTabHoveringText (CreativeTabs .tabAllSearch , mouseX , mouseY );
387
+ if (!this .renderTabHoveringText (CreativeTabs .tabAllSearch , mouseX , mouseY ))
388
+ {
389
+ this .renderTabHoveringText (CreativeTabs .tabInventory , mouseX , mouseY );
390
+ }
377
391
}
378
392
379
393
if (this .binSlot != null && selectedTabIndex == CreativeTabs .tabInventory .getTabIndex () && this .func_146978_c (this .binSlot .xDisplayPosition , this .binSlot .yDisplayPosition , 16 , 16 , mouseX , mouseY ))
380
394
{
381
- this .drawCreativeTabHoveringText (I18n .getString ("inventory.binSlot" ), mouseX , mouseY );
382
- }
383
-
384
- if (this .maxPages != 0 )
385
- {
386
- String page = String .format ("%d / %d" , new Object [] { Integer .valueOf (tabPage + 1 ), Integer .valueOf (this .maxPages + 1 ) });
387
- int width = this .fontRendererObj .getStringWidth (page );
388
- GL11 .glDisable (2896 );
389
- this .zLevel = 300.0F ;
390
- itemRender .zLevel = 300.0F ;
391
- this .fontRendererObj .drawString (page , this .guiLeft + (this .xSize - width ) / 2 , this .guiTop - 44 , -1 );
392
- this .zLevel = 0.0F ;
393
- itemRender .zLevel = 0.0F ;
395
+ String s ;
396
+ if (Keyboard .isKeyDown (Keyboard .KEY_LSHIFT ))
397
+ {
398
+ s = "Clear Inventory" ;
399
+ }
400
+ else {
401
+ s = I18n .getString ("inventory.binSlot" );
402
+ }
403
+ this .drawCreativeTabHoveringText (s , mouseX , mouseY );
394
404
}
395
405
396
406
GL11 .glColor4f (1.0F , 1.0F , 1.0F , 1.0F );
@@ -421,54 +431,68 @@ protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX
421
431
{
422
432
GL11 .glColor4f (1.0F , 1.0F , 1.0F , 1.0F );
423
433
RenderHelper .enableGUIStandardItemLighting ();
424
- CreativeTabs [] acreativetabs = CreativeTabs .creativeTabArray ;
425
- CreativeTabs tab = acreativetabs [selectedTabIndex ];
426
- int k = acreativetabs .length ;
434
+ CreativeTabs [] tabs = CreativeTabs .creativeTabArray ;
435
+ CreativeTabs tab = tabs [selectedTabIndex ];
427
436
428
437
int start = tabPage * 10 ;
429
- k = Math .min (k , start + 12 );
438
+ int end = Math .min (tabs .length , start + 12 );
439
+
430
440
if (tabPage != 0 )
431
- {
432
441
start += 2 ;
433
- }
434
442
435
- for (int l = start ; l < k ; ++l )
443
+ for (int i = start ; i < end ; ++i )
436
444
{
437
- CreativeTabs tab1 = acreativetabs [l ];
445
+ CreativeTabs tab1 = tabs [i ];
446
+ this .mc .getTextureManager ().bindTexture (background );
438
447
439
448
if (tab1 != null && tab1 .getTabIndex () != selectedTabIndex )
440
449
{
441
- this . drawCreativeTab (tab1 );
450
+ drawCreativeTab (tab1 );
442
451
}
443
452
}
444
453
445
- if (tab == CreativeTabs . tabInventory )
454
+ if (tabPage != 0 )
446
455
{
447
- this .renderInventoryTab (mouseX , mouseY , partialTickTime );
456
+ if (tab != CreativeTabs .tabAllSearch )
457
+ {
458
+ this .mc .getTextureManager ().bindTexture (background );
459
+ this .drawCreativeTab (CreativeTabs .tabAllSearch );
460
+ }
461
+ if (tab != CreativeTabs .tabInventory )
462
+ {
463
+ this .mc .getTextureManager ().bindTexture (background );
464
+ this .drawCreativeTab (CreativeTabs .tabInventory );
465
+ }
448
466
}
449
- else
467
+
468
+ this .mc .getTextureManager ().bindTexture (new ResourceLocation ("textures/gui/container/creative_inventory/tab_" + tab .getBackgroundImageName ()));
469
+ this .drawTexturedModalRect (this .guiLeft , this .guiTop , 0 , 0 , this .xSize , this .ySize );
470
+ this .searchField .drawTextBox ();
471
+
472
+ GL11 .glColor4f (1.0F , 1.0F , 1.0F , 1.0F );
473
+ this .mc .getTextureManager ().bindTexture (background );
474
+
475
+ if (tab .shouldHidePlayerInventory ())
450
476
{
451
- this .mc .getTextureManager ().bindTexture (new ResourceLocation ("textures/gui/container/creative_inventory/tab_" + tab .getBackgroundImageName ()));
452
- this .drawTexturedModalRect (this .guiLeft , this .guiTop , 0 , 0 , this .xSize , this .ySize );
453
- this .searchField .drawTextBox ();
454
- GL11 .glColor4f (1.0F , 1.0F , 1.0F , 1.0F );
455
- int i1 = this .guiLeft + 175 ;
456
- k = this .guiTop + 18 ;
457
- int l = k + 112 ;
458
- this .mc .getTextureManager ().bindTexture (background );
459
-
460
- if (tab .shouldHidePlayerInventory ())
477
+ if (this .needsScrollBars ())
461
478
{
462
- this .drawTexturedModalRect (i1 , k + (int ) (( l - k - 17 ) * this .currentScroll ), 232 + ( this . needsScrollBars () ? 0 : 12 ) , 0 , 12 , 15 );
479
+ this .drawTexturedModalRect (this . guiLeft + 175 , this . guiTop + 18 + (int ) (95 * this .currentScroll ), 232 , 0 , 12 , 15 );
463
480
}
464
-
465
- if (tab .getTabPage () != tabPage && tab != CreativeTabs .tabAllSearch )
481
+ else
466
482
{
467
- return ;
483
+ this . drawTexturedModalRect ( this . guiLeft + 175 , this . guiTop + 18 , 244 , 0 , 12 , 15 ) ;
468
484
}
469
485
}
470
486
471
- this .drawCreativeTab (tab );
487
+ if ((tab == CreativeTabs .tabInventory ))
488
+ {
489
+ this .renderInventoryTab (mouseX , mouseY , partialTickTime );
490
+ this .drawCreativeTab (tab );
491
+ }
492
+ else if (tab .getTabPage () == tabPage || tab == CreativeTabs .tabAllSearch )
493
+ {
494
+ this .drawCreativeTab (tab );
495
+ }
472
496
}
473
497
474
498
protected void renderInventoryTab (int mouseX , int mouseY , float partialTickTime )
@@ -584,16 +608,15 @@ protected void renderToolTip(ItemStack stack, int x, int y)
584
608
585
609
for (int i = 0 ; i < len ; ++i )
586
610
{
587
- CreativeTabs creativetabs1 = tabs [i ];
611
+ CreativeTabs tab1 = tabs [i ];
588
612
589
- if (creativetabs1 .func_111226_a (enchantment .type ))
613
+ if (tab1 .func_111226_a (enchantment .type ))
590
614
{
591
- tab = creativetabs1 ;
615
+ tab = tab1 ;
592
616
break ;
593
617
}
594
618
}
595
619
}
596
-
597
620
}
598
621
599
622
if (tab != null )
@@ -613,11 +636,20 @@ protected void renderToolTip(ItemStack stack, int x, int y)
613
636
}
614
637
}
615
638
616
- this .func_146283_a (list , x , y );
639
+ this .drawHoveringText (list , x , y , this . fontRendererObj );
617
640
}
618
641
else
619
642
{
620
- super .renderToolTip (stack , x , y );
643
+ List <String > list = stack .getTooltip (this .mc .thePlayer , this .mc .gameSettings .advancedItemTooltips );
644
+
645
+ list .set (0 , stack .getRarity ().rarityColor + list .get (0 ));
646
+ for (int k = 1 ; k < list .size (); ++k )
647
+ {
648
+ list .set (k , EnumChatFormatting .GRAY + list .get (k ));
649
+ }
650
+
651
+ FontRenderer font = stack .getItem ().getFontRenderer (stack );
652
+ this .drawHoveringText (list , x , y , font == null ? this .fontRendererObj : font );
621
653
}
622
654
}
623
655
0 commit comments