33import com .google .common .collect .ImmutableList ;
44import com .google .gson .JsonParseException ;
55import com .mojang .blaze3d .systems .RenderSystem ;
6-
7- import java .io .IOException ;
8- import java .util .List ;
9- import java .util .Objects ;
10-
116import dev .dfonline .codeclient .ChatType ;
127import dev .dfonline .codeclient .CodeClient ;
138import dev .dfonline .codeclient .Utility ;
149import dev .dfonline .codeclient .actiondump .ActionDump ;
1510import dev .dfonline .codeclient .actiondump .Searchable ;
1611import net .fabricmc .api .EnvType ;
1712import net .fabricmc .api .Environment ;
18- import net .minecraft .client .MinecraftClient ;
1913import net .minecraft .client .font .TextRenderer ;
2014import net .minecraft .client .gui .screen .ingame .AbstractInventoryScreen ;
2115import net .minecraft .client .gui .screen .ingame .CreativeInventoryListener ;
4337import org .jetbrains .annotations .Nullable ;
4438import org .lwjgl .glfw .GLFW ;
4539
40+ import java .io .IOException ;
41+ import java .util .List ;
42+ import java .util .Objects ;
43+
4644import static dev .dfonline .codeclient .dev .DevInventory .DevInventoryGroup .*;
4745
4846@ Environment (EnvType .CLIENT )
@@ -307,7 +305,7 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
307305 Slot slot = this .handler .slots .get (number );
308306 if (this .client == null || this .client .player == null ) return false ;
309307 this .client .player .setStackInHand (Hand .MAIN_HAND , slot .getStack ());
310- CodeClient .MC .getNetworkHandler ().sendPacket (new CreativeInventoryActionC2SPacket (36 + client .player .getInventory ().selectedSlot , slot .getStack ()));
308+ if ( CodeClient . MC . getNetworkHandler () != null ) CodeClient .MC .getNetworkHandler ().sendPacket (new CreativeInventoryActionC2SPacket (36 + client .player .getInventory ().selectedSlot , slot .getStack ()));
311309 this .ignoreNextKey = true ;
312310 return true ;
313311 }
@@ -367,7 +365,7 @@ protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int
367365 if (!itemGroup .hasSearchBar ()) texture = "items" ;
368366 if (itemGroup == INVENTORY ) texture = "inventory" ;
369367 RenderSystem .setShaderTexture (0 , new Identifier (TAB_TEXTURE_PREFIX + texture + ".png" ));
370- this . drawTexture (matrices , this .x , this .y , 0 , 0 , this .backgroundWidth , this .backgroundHeight );
368+ drawTexture (matrices , this .x , this .y , 0 , 0 , this .backgroundWidth , this .backgroundHeight );
371369 RenderSystem .setShaderColor (1.0F , 1.0F , 1.0F , 1.0F );
372370 RenderSystem .setShader (GameRenderer ::getPositionTexProgram );
373371 RenderSystem .setShaderTexture (0 , TEXTURE );
@@ -378,8 +376,8 @@ protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int
378376 RenderSystem .setShaderTexture (0 , TEXTURE );
379377 int scrollbarX = this .x + 175 ;
380378 int scrollbarY = this .y + 18 ;
381- if (scrollHeight == 0 ) this . drawTexture (matrices , scrollbarX , scrollbarY , 244 , 0 , 12 , 15 );
382- else this . drawTexture (matrices , scrollbarX , scrollbarY + (95 * (int ) (this .scrollPosition * 9 ) / (scrollHeight )), 232 , 0 , 12 , 15 );
379+ if (scrollHeight == 0 ) drawTexture (matrices , scrollbarX , scrollbarY , 244 , 0 , 12 , 15 );
380+ else drawTexture (matrices , scrollbarX , scrollbarY + (95 * (int ) (this .scrollPosition * 9 ) / (scrollHeight )), 232 , 0 , 12 , 15 );
383381 }
384382 else {
385383 if (this .client != null && this .client .player != null ) InventoryScreen .drawEntity (matrices , this .x + 88 , this .y + 45 , 20 , (float )(this .x + 88 - mouseX ), (float )(this .y + 45 - 30 - mouseY ), this .client .player );
@@ -406,7 +404,7 @@ protected void renderTabIcon(MatrixStack matrices, DevInventoryGroup group) {
406404 if (isSelected ) mapY += 32 ;
407405 if (!isTopRow ) mapY += 64 ;
408406
409- this . drawTexture (matrices , originX , originY , mapX , mapY , TAB_WIDTH , 32 );
407+ drawTexture (matrices , originX , originY , mapX , mapY , TAB_WIDTH , 32 );
410408// this.itemRenderer.zOffset = 100.0F;
411409 originX += 6 ;
412410 originY += 8 + (isTopRow ? 2 : -2 );
0 commit comments