2323import net .minecraftforge .client .ForgeHooksClient ;
2424import net .minecraftforge .fml .client .config .GuiCheckBox ;
2525import org .dave .compactmachines3 .CompactMachines3 ;
26- import org .dave .compactmachines3 .capability .PlayerShrinkingCapability ;
2726import org .dave .compactmachines3 .gui .GUIHelper ;
2827import org .dave .compactmachines3 .init .Blockss ;
2928import org .dave .compactmachines3 .init .Itemss ;
3433import org .dave .compactmachines3 .network .PackageHandler ;
3534import org .dave .compactmachines3 .utility .ChunkUtils ;
3635import org .dave .compactmachines3 .utility .Logz ;
36+ import org .dave .compactmachines3 .utility .ShrinkingDeviceUtils ;
3737import org .lwjgl .input .Mouse ;
3838import org .lwjgl .opengl .GL11 ;
3939
4242import java .util .List ;
4343
4444public class GuiMachine extends GuiContainer {
45- protected ResourceLocation bgImage ;
4645 protected ResourceLocation tabIcons ;
4746
4847 private int windowWidth = 200 ;
@@ -78,7 +77,6 @@ private boolean shouldShowTabs() {
7877 public void initGui () {
7978 super .initGui ();
8079
81- this .bgImage = new ResourceLocation ("minecraft" , "textures/gui/container/crafting_table.png" );
8280 this .tabIcons = new ResourceLocation (CompactMachines3 .MODID , "textures/gui/tabicons.png" );
8381
8482 int offsetX = (int )((this .width - this .windowWidth ) / 2.0f );
@@ -158,7 +156,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
158156 }
159157
160158 if (GuiMachineData .chunk != null && activeTab == 0 ) {
161- renderChunk ();
159+ renderChunk (partialTicks );
162160
163161 drawOwner (partialTicks , mouseX , mouseY );
164162 drawEnterButton (partialTicks , mouseX , mouseY );
@@ -172,7 +170,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
172170 }
173171
174172 private void drawEnterButton (float partialTicks , int mouseX , int mouseY ) {
175- if (!PlayerShrinkingCapability .hasShrinkingDeviceInInventory (mc .player )) {
173+ if (!ShrinkingDeviceUtils .hasShrinkingDeviceInInventory (mc .player )) {
176174 return ;
177175 }
178176
@@ -229,7 +227,7 @@ protected void drawTabs(float partialTicks, int mouseX, int mouseY) {
229227 float offsetY = (this .height - this .windowHeight ) / 2.0f ;
230228
231229 GlStateManager .pushMatrix ();
232- GlStateManager .translate (offsetX -28 , offsetY , 0 );
230+ GlStateManager .translate (offsetX -28 , offsetY - 1 , 0 );
233231
234232 mc .getTextureManager ().bindTexture (tabIcons );
235233
@@ -266,39 +264,42 @@ protected void drawTabs(float partialTicks, int mouseX, int mouseY) {
266264
267265 protected void drawWindow (float partialTicks , int mouseX , int mouseY ) {
268266 GlStateManager .color (1f , 1f , 1f , 1f );
269- mc .renderEngine .bindTexture (bgImage );
267+ mc .renderEngine .bindTexture (tabIcons );
270268
271269 float offsetX = (this .width - this .windowWidth ) / 2.0f ;
272270 float offsetY = (this .height - this .windowHeight ) / 2.0f ;
273271
274272 GlStateManager .pushMatrix ();
275273 GlStateManager .translate (offsetX , offsetY , 0 );
276274
275+ int texOffsetY = 12 ;
276+ int texOffsetX = 64 ;
277+
277278 // Top Left corner
278- drawTexturedModalRect (0 , 0 , 0 , 0 , 4 , 4 );
279+ drawTexturedModalRect (0 , 0 , texOffsetX , texOffsetY , 4 , 4 );
279280
280281 // Top right corner
281- drawTexturedModalRect (this .windowWidth - 4 , 0 , 172 , 0 , 4 , 4 );
282+ drawTexturedModalRect (this .windowWidth - 4 , 0 , texOffsetX + 4 + 64 , texOffsetY , 4 , 4 );
282283
283284 // Bottom Left corner
284- drawTexturedModalRect (0 , this .windowHeight - 4 , 0 , 162 , 4 , 4 );
285+ drawTexturedModalRect (0 , this .windowHeight - 4 , texOffsetX , texOffsetY + 4 + 64 , 4 , 4 );
285286
286287 // Bottom Right corner
287- drawTexturedModalRect (this .windowWidth - 4 , this .windowHeight - 4 , 172 , 162 , 4 , 4 );
288+ drawTexturedModalRect (this .windowWidth - 4 , this .windowHeight - 4 , texOffsetX + 4 + 64 , texOffsetY + 4 + 64 , 4 , 4 );
288289
289290 // Top edge
290- GUIHelper .drawStretchedTexture (4 , 0 , this .windowWidth - 8 , 4 , 4 , 0 , 4 , 4 );
291+ GUIHelper .drawStretchedTexture (4 , 0 , this .windowWidth - 8 , 4 , texOffsetX + 4 , texOffsetY , 64 , 4 );
291292
292293 // Bottom edge
293- GUIHelper .drawStretchedTexture (4 , this .windowHeight - 4 , this .windowWidth - 8 , 4 , 4 , 162 , 4 , 4 );
294+ GUIHelper .drawStretchedTexture (4 , this .windowHeight - 4 , this .windowWidth - 8 , 4 , texOffsetX + 4 , texOffsetY + 4 + 64 , 64 , 4 );
294295
295296 // Left edge
296- GUIHelper .drawStretchedTexture (0 , 4 , 4 , this .windowHeight - 8 , 0 , 4 , 4 , 4 );
297+ GUIHelper .drawStretchedTexture (0 , 4 , 4 , this .windowHeight - 8 , texOffsetX , texOffsetY + 4 , 4 , 64 );
297298
298299 // Right edge
299- GUIHelper .drawStretchedTexture (this .windowWidth - 4 , 4 , 4 , this .windowHeight - 8 , 172 , 4 , 4 , 4 );
300+ GUIHelper .drawStretchedTexture (this .windowWidth - 4 , 4 , 4 , this .windowHeight - 8 , texOffsetX + 64 + 4 , texOffsetY + 3 , 4 , 64 );
300301
301- GUIHelper .drawStretchedTexture (4 , 4 , this .windowWidth - 8 , this .windowHeight - 8 , 4 , 4 , 1 , 1 );
302+ GUIHelper .drawStretchedTexture (4 , 4 , this .windowWidth - 8 , this .windowHeight - 8 , texOffsetX + 4 , texOffsetY + 4 , 64 , 64 );
302303
303304 GlStateManager .popMatrix ();
304305 }
@@ -374,7 +375,7 @@ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOEx
374375 }
375376 } else if (activeTab == 0 && mouseButton == 0 ) {
376377 boolean mousePressed = this .guiEnterButton .mousePressed (this .mc , mouseX , mouseY );
377- boolean hasDevice = PlayerShrinkingCapability .hasShrinkingDeviceInInventory (mc .player );
378+ boolean hasDevice = ShrinkingDeviceUtils .hasShrinkingDeviceInInventory (mc .player );
378379 boolean validCoords = GuiMachineData .coords != -1 ;
379380 boolean isAllowedToEnter = GuiMachineData .isAllowedToEnter (mc .player );
380381
@@ -444,7 +445,7 @@ public void handleMouseInput() throws IOException {
444445 }
445446 }
446447
447- public void renderChunk () {
448+ public void renderChunk (float partialTicks ) {
448449 // Init GlStateManager
449450 TextureManager textureManager = Minecraft .getMinecraft ().getTextureManager ();
450451 textureManager .bindTexture (TextureMap .LOCATION_BLOCKS_TEXTURE );
@@ -492,6 +493,13 @@ public void renderChunk() {
492493 GlStateManager .rotate (180.0f , 0.0f , 0.0f , -1.0f );
493494
494495 // Auto rotate
496+ /*
497+ int rotationTime = 120; // 6 seconds to rotate one time
498+ int rotationTicks = (int) (Minecraft.getMinecraft().world.getWorldTime() % rotationTime * 8);
499+
500+ float percent = ((rotationTicks / 8.0f) + partialTicks) / rotationTime;
501+ */
502+
495503 GlStateManager .rotate (rotateX == 0.0d ? RenderTickCounter .renderTicks * 45.0f / 128.0f : (float )rotateX , 0.0f , 1.0f , 0.0f );
496504
497505 // Get rid of the wall+floor
0 commit comments