diff options
Diffstat (limited to 'src/main/java/gregtech/common/GT_Client.java')
-rw-r--r-- | src/main/java/gregtech/common/GT_Client.java | 136 |
1 files changed, 87 insertions, 49 deletions
diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 351a1aac16..9938b46ab0 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -101,17 +101,25 @@ public class GT_Client extends GT_Proxy implements Runnable { // don't ask. these "just works" private static final Transformation ROTATION_MARKER_TRANSFORM_CENTER = new Scale(0.5); private static final Transformation[] ROTATION_MARKER_TRANSFORMS_SIDES_TRANSFORMS = { - new Scale(0.25).with(new Translation(0, 0, 0.375)).compile(), - new Scale(0.25).with(new Translation(0.375, 0, 0)).compile(), - new Scale(0.25).with(new Translation(0, 0, -0.375)).compile(), - new Scale(0.25).with(new Translation(-0.375, 0, 0)).compile(), }; + new Scale(0.25).with(new Translation(0, 0, 0.375)) + .compile(), + new Scale(0.25).with(new Translation(0.375, 0, 0)) + .compile(), + new Scale(0.25).with(new Translation(0, 0, -0.375)) + .compile(), + new Scale(0.25).with(new Translation(-0.375, 0, 0)) + .compile(), }; private static final int[] ROTATION_MARKER_TRANSFORMS_SIDES = { -1, -1, 2, 0, 3, 1, -1, -1, 0, 2, 3, 1, 0, 2, -1, -1, 3, 1, 2, 0, -1, -1, 3, 1, 1, 3, 2, 0, -1, -1, 3, 1, 2, 0, -1, -1 }; private static final Transformation[] ROTATION_MARKER_TRANSFORMS_CORNER = { - new Scale(0.25).with(new Translation(0.375, 0, 0.375)).compile(), - new Scale(0.25).with(new Translation(-0.375, 0, 0.375)).compile(), - new Scale(0.25).with(new Translation(0.375, 0, -0.375)).compile(), - new Scale(0.25).with(new Translation(-0.375, 0, -0.375)).compile(), }; + new Scale(0.25).with(new Translation(0.375, 0, 0.375)) + .compile(), + new Scale(0.25).with(new Translation(-0.375, 0, 0.375)) + .compile(), + new Scale(0.25).with(new Translation(0.375, 0, -0.375)) + .compile(), + new Scale(0.25).with(new Translation(-0.375, 0, -0.375)) + .compile(), }; private static int rotationMarkerDisplayList; private static boolean rotationMarkerDisplayListCompiled = false; @@ -314,8 +322,10 @@ public class GT_Client extends GT_Proxy implements Runnable { GL11.glVertex3d(+.25D, .0D, +.50D); GL11.glVertex3d(-.25D, .0D, -.50D); GL11.glVertex3d(-.25D, .0D, +.50D); - final TileEntity tTile = aEvent.player.worldObj - .getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ); + final TileEntity tTile = aEvent.player.worldObj.getTileEntity( + aEvent.target.blockX, + aEvent.target.blockY, + aEvent.target.blockZ); // draw connection indicators byte tConnections = 0; @@ -392,17 +402,19 @@ public class GT_Client extends GT_Proxy implements Runnable { final ForgeDirection direction = tAlignment.getDirection(); if (direction.ordinal() == tSideHit) drawExtendedRotationMarker(ROTATION_MARKER_TRANSFORM_CENTER, aIsSneaking, false); - else if (direction.getOpposite().ordinal() == tSideHit) { - for (Transformation t : ROTATION_MARKER_TRANSFORMS_CORNER) { - drawExtendedRotationMarker(t, aIsSneaking, true); - } - } else { - drawExtendedRotationMarker( - ROTATION_MARKER_TRANSFORMS_SIDES_TRANSFORMS[ROTATION_MARKER_TRANSFORMS_SIDES[tSideHit * 6 - + direction.ordinal()]], - aIsSneaking, - true); - } + else if (direction.getOpposite() + .ordinal() + == tSideHit) { + for (Transformation t : ROTATION_MARKER_TRANSFORMS_CORNER) { + drawExtendedRotationMarker(t, aIsSneaking, true); + } + } else { + drawExtendedRotationMarker( + ROTATION_MARKER_TRANSFORMS_SIDES_TRANSFORMS[ROTATION_MARKER_TRANSFORMS_SIDES[tSideHit + * 6 + direction.ordinal()]], + aIsSneaking, + true); + } } } GL11.glPopMatrix(); // get back to player center @@ -518,8 +530,10 @@ public class GT_Client extends GT_Proxy implements Runnable { super.onPreLoad(); MinecraftForge.EVENT_BUS.register(new ExtraIcons()); - Minecraft.getMinecraft().getResourcePackRepository().rprMetadataSerializer - .registerMetadataSectionType(new ColorsMetadataSectionSerializer(), ColorsMetadataSection.class); + Minecraft.getMinecraft() + .getResourcePackRepository().rprMetadataSerializer.registerMetadataSectionType( + new ColorsMetadataSectionSerializer(), + ColorsMetadataSection.class); new GT_MetaTileEntity_AdvDebugStructureWriter.ForgeEventHandler(); @@ -580,7 +594,8 @@ public class GT_Client extends GT_Proxy implements Runnable { for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) { try { if (GregTech_API.METATILEENTITIES[i] != null) { - GregTech_API.METATILEENTITIES[i].getStackForm(1L).getTooltip(null, true); + GregTech_API.METATILEENTITIES[i].getStackForm(1L) + .getTooltip(null, true); GT_Log.out.println("META " + i + " " + GregTech_API.METATILEENTITIES[i].getMetaName()); } } catch (Throwable e) { @@ -594,16 +609,19 @@ public class GT_Client extends GT_Proxy implements Runnable { // reobf doesn't work with lambda, so this must be a class // noinspection Convert2Lambda - ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()) - .registerReloadListener(new IResourceManagerReloadListener() { - - @Override - public void onResourceManagerReload(IResourceManager l) { - GT_GUIColorOverride.onResourceManagerReload(); - FallbackableSteamTexture.reload(); - GregTech_API.sCoverBehaviors.values().forEach(GT_CoverBehaviorBase::reloadColorOverride); - } - }); + ((IReloadableResourceManager) Minecraft.getMinecraft() + .getResourceManager()).registerReloadListener( + new IResourceManagerReloadListener() { + + @Override + public void onResourceManagerReload(IResourceManager l) { + GT_GUIColorOverride.onResourceManagerReload(); + FallbackableSteamTexture.reload(); + GregTech_API.sCoverBehaviors.values() + .forEach( + GT_CoverBehaviorBase::reloadColorOverride); + } + }); } @Override @@ -611,7 +629,9 @@ public class GT_Client extends GT_Proxy implements Runnable { GT_Log.out.println("GT_Mod: Downloading Cape List."); try (final Scanner tScanner = new Scanner(new URL(GT_CAPE_LIST_URL).openStream())) { while (tScanner.hasNextLine()) { - this.mCapeList.add(tScanner.nextLine().toLowerCase()); + this.mCapeList.add( + tScanner.nextLine() + .toLowerCase()); } } catch (Throwable e) { e.printStackTrace(GT_Log.err); @@ -619,7 +639,8 @@ public class GT_Client extends GT_Proxy implements Runnable { GT_Log.out.println("GT New Horizons: Downloading Cape List."); try (final Scanner tScanner = new Scanner(new URL(GTNH_CAPE_LIST_URL).openStream())) { while (tScanner.hasNextLine()) { - final String tName = tScanner.nextLine().toLowerCase(); + final String tName = tScanner.nextLine() + .toLowerCase(); if (tName.contains(":")) { if (!this.mCapeList.contains(tName.substring(0, tName.indexOf(":")))) { this.mCapeList.add(tName); @@ -659,7 +680,8 @@ public class GT_Client extends GT_Proxy implements Runnable { mFirstTick = false; GT_Values.NW.sendToServer(new GT_Packet_ClientPreference(mPreference)); - if (!Minecraft.getMinecraft().isSingleplayer()) { + if (!Minecraft.getMinecraft() + .isSingleplayer()) { // Check for more IC2 recipes to also catch MineTweaker additions GT_ModHandler.addIC2RecipesToGT( GT_ModHandler.getMaceratorRecipeList(), @@ -701,7 +723,7 @@ public class GT_Client extends GT_Proxy implements Runnable { } } for (Iterator<Map.Entry<GT_PlayedSound, Integer>> iterator = GT_Utility.sPlayedSoundMap.entrySet() - .iterator(); iterator.hasNext();) { + .iterator(); iterator.hasNext();) { Map.Entry<GT_PlayedSound, Integer> tEntry = iterator.next(); if (tEntry.getValue() < 0) { iterator.remove(); @@ -718,8 +740,10 @@ public class GT_Client extends GT_Proxy implements Runnable { mLastUpdatedBlockX = trace.blockX; mLastUpdatedBlockY = trace.blockY; mLastUpdatedBlockZ = trace.blockZ; - final TileEntity tileEntity = aEvent.player.worldObj - .getTileEntity(trace.blockX, trace.blockY, trace.blockZ); + final TileEntity tileEntity = aEvent.player.worldObj.getTileEntity( + trace.blockX, + trace.blockY, + trace.blockZ); if (tileEntity instanceof IGregTechTileEntity) { final IGregTechTileEntity gtTile = (IGregTechTileEntity) tileEntity; if (gtTile.getMetaTileEntity() instanceof IHasFluidDisplayItem) { @@ -749,10 +773,14 @@ public class GT_Client extends GT_Proxy implements Runnable { @SubscribeEvent public void onDrawBlockHighlight(DrawBlockHighlightEvent aEvent) { - final Block aBlock = aEvent.player.worldObj - .getBlock(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ); - final TileEntity aTileEntity = aEvent.player.worldObj - .getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ); + final Block aBlock = aEvent.player.worldObj.getBlock( + aEvent.target.blockX, + aEvent.target.blockY, + aEvent.target.blockZ); + final TileEntity aTileEntity = aEvent.player.worldObj.getTileEntity( + aEvent.target.blockX, + aEvent.target.blockY, + aEvent.target.blockZ); if (GT_Utility.isStackInList(aEvent.currentItem, GregTech_API.sWrenchList)) { if (aTileEntity instanceof ITurnable || ROTATABLE_VANILLA_BLOCKS.contains(aBlock) @@ -975,11 +1003,20 @@ public class GT_Client extends GT_Proxy implements Runnable { } if (tString.startsWith("streaming.")) { new WorldSpawnedEventBuilder.RecordEffectEventBuilder().setIdentifier(tString.substring(10)) - .setPosition(aX, aY, aZ).run(); + .setPosition(aX, aY, aZ) + .run(); } else { - new WorldSpawnedEventBuilder.SoundEventBuilder().setVolume(3f).setPitch( - tString.startsWith("note.") ? (float) Math.pow(2D, (double) (aStack.stackSize - 13) / 12D) : 1.0F) - .setIdentifier(tString).setPosition(aX, aY, aZ).run(); + new WorldSpawnedEventBuilder.SoundEventBuilder().setVolume(3f) + .setPitch( + tString.startsWith("note.") + ? (float) Math.pow( + 2D, + (double) (aStack.stackSize - 13) + / 12D) + : 1.0F) + .setIdentifier(tString) + .setPosition(aX, aY, aZ) + .run(); } } @@ -1005,7 +1042,8 @@ public class GT_Client extends GT_Proxy implements Runnable { final int[] ids = OreDictionary.getOreIDs(tCurrentItem); int hide = 0; for (int i : ids) { - if (OreDictionary.getOreName(i).equals("craftingToolSolderingIron")) { + if (OreDictionary.getOreName(i) + .equals("craftingToolSolderingIron")) { hide |= 0x1; break; } |