From 55f64675b42ac8d3c557cc850f78664bee006f6f Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 28 Jan 2023 19:32:44 -0800 Subject: [ci skip] spotlessApply with the new settings --- .../gtPlusPlus/core/util/MovingAverageLong.java | 3 + src/main/java/gtPlusPlus/core/util/Utils.java | 224 +- src/main/java/gtPlusPlus/core/util/data/AES.java | 4 +- .../java/gtPlusPlus/core/util/data/ArrayUtils.java | 16 +- .../java/gtPlusPlus/core/util/data/EnumUtils.java | 9 +- .../java/gtPlusPlus/core/util/data/FileUtils.java | 14 +- .../gtPlusPlus/core/util/data/LocaleUtils.java | 19 +- .../gtPlusPlus/core/util/data/StringUtils.java | 5 +- .../gtPlusPlus/core/util/debug/DEBUG_INIT.java | 14 +- .../core/util/debug/DEBUG_ITEM_ShapeSpawner.java | 12 +- .../util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java | 138 +- .../core/util/debug/DEBUG_ScreenOverlay.java | 24 +- .../core/util/debug/DEBUG_TimerThread.java | 32 +- .../core/util/debug/UtilityGL11Debug.java | 2323 +++++++++++--------- .../java/gtPlusPlus/core/util/math/MathUtils.java | 136 +- .../core/util/minecraft/EnchantingUtils.java | 3 +- .../core/util/minecraft/EnergyUtils.java | 12 +- .../core/util/minecraft/EntityUtils.java | 193 +- .../gtPlusPlus/core/util/minecraft/FluidUtils.java | 274 +-- .../gtPlusPlus/core/util/minecraft/FoodUtils.java | 3 +- .../core/util/minecraft/HazmatUtils.java | 87 +- .../core/util/minecraft/InventoryUtils.java | 35 +- .../gtPlusPlus/core/util/minecraft/ItemUtils.java | 277 +-- .../gtPlusPlus/core/util/minecraft/LangUtils.java | 27 +- .../core/util/minecraft/MaterialUtils.java | 205 +- .../core/util/minecraft/MiningUtils.java | 63 +- .../core/util/minecraft/ModularArmourUtils.java | 9 +- .../gtPlusPlus/core/util/minecraft/NBTUtils.java | 90 +- .../core/util/minecraft/OreDictUtils.java | 1 + .../core/util/minecraft/PlayerUtils.java | 31 +- .../core/util/minecraft/RecipeUtils.java | 295 +-- .../core/util/minecraft/ShapelessUtils.java | 4 +- .../util/minecraft/gregtech/PollutionUtils.java | 10 +- .../gregtech/material/MaterialBuilder.java | 291 +-- .../gregtech/recipehandlers/GregtechRecipe.java | 3 +- .../core/util/minecraft/network/CustomPacket.java | 8 +- .../core/util/minecraft/network/PacketBuilder.java | 3 +- .../util/minecraft/network/PacketDispatcher.java | 36 +- .../core/util/minecraft/network/PacketHandler.java | 18 +- .../util/minecraft/network/PacketTileEntity.java | 14 +- .../minecraft/particles/BlockBreakParticles.java | 3 +- .../particles/EntityParticleFXMysterious.java | 11 +- .../gtPlusPlus/core/util/player/PlayerCache.java | 40 +- .../core/util/reflect/AddGregtechRecipe.java | 158 +- .../gtPlusPlus/core/util/reflect/ProxyFinder.java | 3 +- .../core/util/reflect/ReflectionUtils.java | 134 +- .../gtPlusPlus/core/util/sys/KeyboardUtils.java | 5 +- src/main/java/gtPlusPlus/core/util/sys/Log.java | 1 + .../java/gtPlusPlus/core/util/sys/SystemUtils.java | 4 +- 49 files changed, 2524 insertions(+), 2800 deletions(-) (limited to 'src/main/java/gtPlusPlus/core/util') diff --git a/src/main/java/gtPlusPlus/core/util/MovingAverageLong.java b/src/main/java/gtPlusPlus/core/util/MovingAverageLong.java index fee1fe84bc..202f10072a 100644 --- a/src/main/java/gtPlusPlus/core/util/MovingAverageLong.java +++ b/src/main/java/gtPlusPlus/core/util/MovingAverageLong.java @@ -4,9 +4,11 @@ import java.math.BigInteger; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.Arrays; + import net.minecraft.nbt.NBTTagCompound; public class MovingAverageLong { + private final long[] storage; private int ptr; @@ -39,6 +41,7 @@ public class MovingAverageLong { /** * if read failed, the internal states would not be changed. + * * @return true if successful, false otherwise. */ public boolean read(NBTTagCompound tagCompound, String key) { diff --git a/src/main/java/gtPlusPlus/core/util/Utils.java b/src/main/java/gtPlusPlus/core/util/Utils.java index 2242b7e673..b95574fc60 100644 --- a/src/main/java/gtPlusPlus/core/util/Utils.java +++ b/src/main/java/gtPlusPlus/core/util/Utils.java @@ -1,35 +1,5 @@ package gtPlusPlus.core.util; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.registry.EntityRegistry; -import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TC_Aspects; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.NBTUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.core.util.sys.SystemUtils; -import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; -import ic2.core.Ic2Items; -import ic2.core.init.InternalName; -import ic2.core.item.resources.ItemCell; import java.awt.Color; import java.awt.Graphics; import java.io.ByteArrayOutputStream; @@ -49,7 +19,9 @@ import java.util.List; import java.util.Map; import java.util.Timer; import java.util.TimerTask; + import javax.xml.bind.DatatypeConverter; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; @@ -68,8 +40,40 @@ import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; + import org.apache.commons.lang3.EnumUtils; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TC_Aspects; +import gregtech.api.enums.TC_Aspects.TC_AspectStack; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.NBTUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.core.util.sys.SystemUtils; +import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; +import ic2.core.Ic2Items; +import ic2.core.init.InternalName; +import ic2.core.item.resources.ItemCell; + public class Utils { public static final int WILDCARD_VALUE = Short.MAX_VALUE; @@ -83,6 +87,7 @@ public class Utils { } static class ShortTimerTask extends TimerTask { + @Override public void run() { Logger.WARNING("Timer expired."); @@ -174,9 +179,8 @@ public class Utils { if ((input == null) || (target == null)) { return false; } - return ((target.getItem() == input.getItem()) - && (((target.getItemDamage() == WILDCARD_VALUE) && !strict) - || (target.getItemDamage() == input.getItemDamage()))); + return ((target.getItem() == input.getItem()) && (((target.getItemDamage() == WILDCARD_VALUE) && !strict) + || (target.getItemDamage() == input.getItemDamage()))); } // Register an event to both busses. @@ -217,12 +221,10 @@ public class Utils { } /* - * public static void recipeBuilderBlock(ItemStack slot_1, ItemStack slot_2, - * ItemStack slot_3, ItemStack slot_4, ItemStack slot_5, ItemStack slot_6, - * ItemStack slot_7, ItemStack slot_8, ItemStack slot_9, Block resultBlock){ - * GameRegistry.addRecipe(new ItemStack(resultBlock), new Object[] {"ABC", - * "DEF", "GHI", 'A',slot_1,'B',slot_2,'C',slot_3, - * 'D',slot_4,'E',slot_5,'F',slot_6, 'G',slot_7,'H',slot_8,'I',slot_9 }); } + * public static void recipeBuilderBlock(ItemStack slot_1, ItemStack slot_2, ItemStack slot_3, ItemStack slot_4, + * ItemStack slot_5, ItemStack slot_6, ItemStack slot_7, ItemStack slot_8, ItemStack slot_9, Block resultBlock){ + * GameRegistry.addRecipe(new ItemStack(resultBlock), new Object[] {"ABC", "DEF", "GHI", + * 'A',slot_1,'B',slot_2,'C',slot_3, 'D',slot_4,'E',slot_5,'F',slot_6, 'G',slot_7,'H',slot_8,'I',slot_9 }); } */ public static String checkCorrectMiningToolForBlock(final Block currentBlock, final World currentWorld) { @@ -242,8 +244,7 @@ public class Utils { /** * - * @param colourStr - * e.g. "#FFFFFF" + * @param colourStr e.g. "#FFFFFF" * @return String - formatted "rgb(0,0,0)" */ public static String hex2RgbFormatted(final String hexString) { @@ -265,8 +266,7 @@ public class Utils { /** * - * @param colourStr - * e.g. "#FFFFFF" + * @param colourStr e.g. "#FFFFFF" * @return */ public static Color hex2Rgb(final String colorStr) { @@ -278,8 +278,7 @@ public class Utils { /** * - * @param colourInt - * e.g. 0XFFFFFF + * @param colourInt e.g. 0XFFFFFF * @return Colour */ public static Color hex2Rgb(final int colourInt) { @@ -288,15 +287,13 @@ public class Utils { /** * - * @param colourInt - * e.g. 0XFFFFFF + * @param colourInt e.g. 0XFFFFFF * @return short[] */ public static short[] hex2RgbShort(final int colourInt) { final Color rgb = Color.decode(String.valueOf(colourInt)); - final short[] rgba = { - (short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), (short) rgb.getAlpha() - }; + final short[] rgba = { (short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), + (short) rgb.getAlpha() }; return rgba; } @@ -336,8 +333,8 @@ public class Utils { GTplusplus.proxy.generateMysteriousParticles(entity); } - public static void spawnFX( - final World world, final int x, final int y, final int z, final String particleName, Object particleName2) { + public static void spawnFX(final World world, final int x, final int y, final int z, final String particleName, + Object particleName2) { if (!world.isRemote) { if ((particleName2 == null) || particleName2.equals("")) { particleName2 = particleName; @@ -404,8 +401,7 @@ public class Utils { } /* - * Original Code by Chandana Napagoda - - * https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator. + * Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator. * html */ public static Map hexColourGenerator(final int colorCount) { @@ -417,21 +413,16 @@ public class Utils { for (int a = 0; (a < colorCount) && (maxColorValue >= countValue); a++) { if (a != 0) { countValue += devidedvalue; - hexColorMap.put( - a, - Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase()); + hexColorMap.put(a, Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase()); } else { - hexColorMap.put( - a, - Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase()); + hexColorMap.put(a, Integer.toHexString(0x10000 | countValue).substring(1).toUpperCase()); } } return hexColorMap; } /* - * Original Code by Chandana Napagoda - - * https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator. + * Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator. * html */ public static Map hexColourGeneratorRandom(final int colorCount) { @@ -521,7 +512,9 @@ public class Utils { final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); Logger.WARNING("Successfully created " + temp.getDisplayName() + "s."); FluidContainerRegistry.registerFluidContainer( - FluidUtils.getFluidStack(s.toLowerCase(), 1000), temp.copy(), Ic2Items.cell.copy()); + FluidUtils.getFluidStack(s.toLowerCase(), 1000), + temp.copy(), + Ic2Items.cell.copy()); ItemUtils.addItemToOreDictionary(temp.copy(), "cell" + s); return temp; } catch (final Exception e) { @@ -547,7 +540,9 @@ public class Utils { final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); Logger.WARNING("Successfully created " + temp.getDisplayName() + "s."); FluidContainerRegistry.registerFluidContainer( - FluidUtils.getFluidStack(s.toLowerCase(), 1000), temp.copy(), Ic2Items.cell.copy()); + FluidUtils.getFluidStack(s.toLowerCase(), 1000), + temp.copy(), + Ic2Items.cell.copy()); // ItemUtils.addItemToOreDictionary(temp.copy(), "cell"+s); return temp; } catch (final Exception e) { @@ -647,8 +642,8 @@ public class Utils { return compareModVersion(currentVersion, expectedVersion, "//."); } - public static Versioning compareModVersion( - final String currentVersion, final String expectedVersion, final String delimiter) { + public static Versioning compareModVersion(final String currentVersion, final String expectedVersion, + final String delimiter) { final String[] a = parseVersion(currentVersion, delimiter); final String[] b = parseVersion(expectedVersion, delimiter); final int[] c = new int[a.length]; @@ -693,8 +688,8 @@ public class Utils { final float damage = gtMaterial.mToolQuality; final int efficiency = (int) gtMaterial.mToolSpeed; final int enchantability = gtMaterial.mEnchantmentToolsLevel; - final ToolMaterial temp = - EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, enchantability); + final ToolMaterial temp = EnumHelper + .addToolMaterial(name, harvestLevel, durability, efficiency, damage, enchantability); return temp; } @@ -705,16 +700,26 @@ public class Utils { final float damage = material.vToolQuality; final int efficiency = material.vToolQuality; // int enchantability = material.mEnchantmentToolsLevel; - Logger.INFO("ToolMaterial stats for " + material.getLocalizedName() + " | harvestLevel:" + harvestLevel - + " | durability:" + durability + " | toolQuality:" + damage + " | toolSpeed:" + damage); + Logger.INFO( + "ToolMaterial stats for " + material.getLocalizedName() + + " | harvestLevel:" + + harvestLevel + + " | durability:" + + durability + + " | toolQuality:" + + damage + + " | toolSpeed:" + + damage); final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, 0); return temp; } public static enum Versioning { + EQUAL(0), NEWER(1), OLDER(-1); + private final int versioningInfo; private Versioning(final int versionStatus) { @@ -728,11 +733,7 @@ public class Utils { public static String addBookTitleLocalization(final String aTitle) { return GT_LanguageManager.addStringLocalization( - new StringBuilder() - .append("Book.") - .append(aTitle) - .append(".Name") - .toString(), + new StringBuilder().append("Book.").append(aTitle).append(".Name").toString(), aTitle, !GregTech_API.sPostloadFinished); } @@ -741,17 +742,8 @@ public class Utils { String[] aLocalizationPages = new String[aPages.length]; for (byte i = 0; i < aPages.length; i = (byte) (i + 1)) { aLocalizationPages[i] = GT_LanguageManager.addStringLocalization( - new StringBuilder() - .append("Book.") - .append(aTitle) - .append(".Page") - .append( - (i < 10) - ? new StringBuilder() - .append("0") - .append(i) - .toString() - : Byte.valueOf(i)) + new StringBuilder().append("Book.").append(aTitle).append(".Page") + .append((i < 10) ? new StringBuilder().append("0").append(i).toString() : Byte.valueOf(i)) .toString(), aPages[i], !GregTech_API.sPostloadFinished); @@ -759,19 +751,14 @@ public class Utils { return aLocalizationPages; } - public static ItemStack getWrittenBook( - final ItemStack aBook, - final int aID, - final String aMapping, - final String aTitle, - final String aAuthor, - final String[] aPages) { + public static ItemStack getWrittenBook(final ItemStack aBook, final int aID, final String aMapping, + final String aTitle, final String aAuthor, final String[] aPages) { if (GT_Utility.isStringInvalid(aMapping)) { return null; } ItemStack rStack = CORE.sBookList.get(aMapping); if (rStack != null) { - return GT_Utility.copyAmount(1L, new Object[] {rStack}); + return GT_Utility.copyAmount(1L, new Object[] { rStack }); } if ((GT_Utility.isStringInvalid(aTitle)) || (GT_Utility.isStringInvalid(aAuthor)) || (aPages.length <= 0)) { return null; @@ -791,45 +778,36 @@ public class Utils { tNBTList.appendTag(new NBTTagString(aPages[i])); } else { Logger.INFO("WARNING: String for written Book too long! -> " + aPages[i]); - GT_Log.err.println(new StringBuilder() - .append("WARNING: String for written Book too long! -> ") - .append(aPages[i]) - .toString()); + GT_Log.err.println( + new StringBuilder().append("WARNING: String for written Book too long! -> ") + .append(aPages[i]).toString()); } } else { Logger.INFO("WARNING: Too much Pages for written Book! -> " + aTitle); - GT_Log.err.println(new StringBuilder() - .append("WARNING: Too much Pages for written Book! -> ") - .append(aTitle) - .toString()); + GT_Log.err.println( + new StringBuilder().append("WARNING: Too much Pages for written Book! -> ").append(aTitle) + .toString()); break; } } - tNBTList.appendTag(new NBTTagString(new StringBuilder() - .append("Credits to ") - .append(aAuthor) - .append(" for writing this Book. This was Book Nr. ") - .append(aID) - .append(" at its creation. Gotta get 'em all!") - .toString())); + tNBTList.appendTag( + new NBTTagString( + new StringBuilder().append("Credits to ").append(aAuthor) + .append(" for writing this Book. This was Book Nr. ").append(aID) + .append(" at its creation. Gotta get 'em all!").toString())); tNBT.setTag("pages", tNBTList); rStack.setTagCompound(tNBT); - GT_Log.out.println(new StringBuilder() - .append("GT++_Mod: Added Book to Book++ List - Mapping: '") - .append(aMapping) - .append("' - Name: '") - .append(aTitle) - .append("' - Author: '") - .append(aAuthor) - .append("'") - .toString()); + GT_Log.out.println( + new StringBuilder().append("GT++_Mod: Added Book to Book++ List - Mapping: '").append(aMapping) + .append("' - Name: '").append(aTitle).append("' - Author: '").append(aAuthor).append("'") + .toString()); NBTUtils.createIntegerTagCompound(rStack, "stats", "mMeta", vMeta); CORE.sBookList.put(aMapping, rStack); Logger.INFO("Creating book: " + aTitle + " by " + aAuthor + ". Using Meta " + vMeta + "."); - return GT_Utility.copy(new Object[] {rStack}); + return GT_Utility.copy(new Object[] { rStack }); } - @SuppressWarnings({"unused", "unchecked"}) + @SuppressWarnings({ "unused", "unchecked" }) public static Pair getGregtechVersion() { Pair version; if (GT_Mod.VERSION == 509) { @@ -915,12 +893,10 @@ public class Utils { out.writeObject(bytes); out.flush(); result = bos.toByteArray(); - } catch (IOException e) { - } finally { + } catch (IOException e) {} finally { try { bos.close(); - } catch (IOException e) { - } + } catch (IOException e) {} } return calculateChecksumMD5(result); } diff --git a/src/main/java/gtPlusPlus/core/util/data/AES.java b/src/main/java/gtPlusPlus/core/util/data/AES.java index e782a48148..8f9580c760 100644 --- a/src/main/java/gtPlusPlus/core/util/data/AES.java +++ b/src/main/java/gtPlusPlus/core/util/data/AES.java @@ -7,13 +7,13 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.Base64; + import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class AES { - private final String secret; - ; + private final String secret;; private final SecretKeySpec secretKey; diff --git a/src/main/java/gtPlusPlus/core/util/data/ArrayUtils.java b/src/main/java/gtPlusPlus/core/util/data/ArrayUtils.java index 8630ac5abf..75a3daacad 100644 --- a/src/main/java/gtPlusPlus/core/util/data/ArrayUtils.java +++ b/src/main/java/gtPlusPlus/core/util/data/ArrayUtils.java @@ -1,15 +1,17 @@ package gtPlusPlus.core.util.data; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; + import net.minecraft.item.ItemStack; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; + public class ArrayUtils { public static V[] expandArray(final V[] someArray, final V newValueToAdd) { @@ -36,10 +38,12 @@ public class ArrayUtils { return newArray; } - /*public static Object getMostCommonElement(List list) { - Optional r = list.stream().map(V::getTextureSet).collect(Collectors.groupingBy(Function.identity(), Collectors.counting())).entrySet().stream().max(Map.Entry.comparingByValue()).map(Map.Entry::getKey); - return r.get(); - }*/ + /* + * public static Object getMostCommonElement(List list) { Optional r = + * list.stream().map(V::getTextureSet).collect(Collectors.groupingBy(Function.identity(), + * Collectors.counting())).entrySet().stream().max(Map.Entry.comparingByValue()).map(Map.Entry::getKey); return + * r.get(); } + */ public static Object[] removeNulls(final Object[] v) { List list = new ArrayList(Arrays.asList(v)); diff --git a/src/main/java/gtPlusPlus/core/util/data/EnumUtils.java b/src/main/java/gtPlusPlus/core/util/data/EnumUtils.java index 2a74edb5aa..71d0c16e14 100644 --- a/src/main/java/gtPlusPlus/core/util/data/EnumUtils.java +++ b/src/main/java/gtPlusPlus/core/util/data/EnumUtils.java @@ -6,9 +6,8 @@ import com.google.common.base.Optional; public class EnumUtils { /** - * Returns the value of an Enum if it exists. - * If value is not found, case-insensitive search will occur. - * If value still not found, an IllegalArgumentException is thrown. + * Returns the value of an Enum if it exists. If value is not found, case-insensitive search will occur. If value + * still not found, an IllegalArgumentException is thrown. **/ public static > T getValue(Class enumeration, String name) { Optional j = Enums.getIfPresent(enumeration, name); @@ -22,8 +21,8 @@ public class EnumUtils { } /** - * Finds the value of the given enumeration by name, case-insensitive. - * Throws an IllegalArgumentException if no match is found. + * Finds the value of the given enumeration by name, case-insensitive. Throws an IllegalArgumentException if no + * match is found. **/ private static > T valueOfIgnoreCase(Class enumeration, String name) { diff --git a/src/main/java/gtPlusPlus/core/util/data/FileUtils.java b/src/main/java/gtPlusPlus/core/util/data/FileUtils.java index 19f868c2a9..cec639a76c 100644 --- a/src/main/java/gtPlusPlus/core/util/data/FileUtils.java +++ b/src/main/java/gtPlusPlus/core/util/data/FileUtils.java @@ -1,7 +1,5 @@ package gtPlusPlus.core.util.data; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; @@ -13,6 +11,9 @@ import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.Utils; + public class FileUtils { private static final Charset utf8 = StandardCharsets.UTF_8; @@ -90,16 +91,15 @@ public class FileUtils { return newSize > oldSize; } } - } catch (IOException e) { - } + } catch (IOException e) {} return false; } /** - * Reads the contents of a file line by line to a List of Strings using the default encoding for the VM. - * The file is always closed. + * Reads the contents of a file line by line to a List of Strings using the default encoding for the VM. The file is + * always closed. * - * @param file the file to read, must not be {@code null} + * @param file the file to read, must not be {@code null} * @return the list of Strings representing each line in the file, never {@code null} * @throws IOException in case of an I/O error * @since 1.3 diff --git a/src/main/java/gtPlusPlus/core/util/data/LocaleUtils.java b/src/main/java/gtPlusPlus/core/util/data/LocaleUtils.java index a67262c4bd..2ad38d1de5 100644 --- a/src/main/java/gtPlusPlus/core/util/data/LocaleUtils.java +++ b/src/main/java/gtPlusPlus/core/util/data/LocaleUtils.java @@ -1,14 +1,16 @@ package gtPlusPlus.core.util.data; +import java.io.*; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.registry.GameData; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import java.io.*; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; public class LocaleUtils { @@ -41,8 +43,7 @@ public class LocaleUtils { } } - } catch (Throwable T) { - } + } catch (Throwable T) {} } writeToFile("Dumping Blocks from " + mod.getModId() + "."); for (Object B : GameData.getBlockRegistry()) { @@ -61,8 +62,7 @@ public class LocaleUtils { } } - } catch (Throwable T) { - } + } catch (Throwable T) {} } return true; @@ -76,7 +76,6 @@ public class LocaleUtils { writer.write(S); writer.newLine(); writer.close(); - } catch (IOException e) { - } + } catch (IOException e) {} } } diff --git a/src/main/java/gtPlusPlus/core/util/data/StringUtils.java b/src/main/java/gtPlusPlus/core/util/data/StringUtils.java index af40dbae41..d837901ea8 100644 --- a/src/main/java/gtPlusPlus/core/util/data/StringUtils.java +++ b/src/main/java/gtPlusPlus/core/util/data/StringUtils.java @@ -82,6 +82,7 @@ public class StringUtils { // Can call this Enum for formatting. public static enum TextUtils { + blue('1'), green('2'), teal('3'), @@ -136,12 +137,12 @@ public class StringUtils { /** * Is this a special regex character for delimination? (.$|()[]{}^?*+\\) + * * @param aChar - The char to test * @return - Is this a special character? */ public static boolean isSpecialCharacter(char aChar) { - if (aChar == '"' - || aChar == '.' + if (aChar == '"' || aChar == '.' || aChar == '$' || aChar == '|' || aChar == '(' diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_INIT.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_INIT.java index a6441ee558..56c93d4a4d 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_INIT.java +++ b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_INIT.java @@ -10,12 +10,14 @@ public class DEBUG_INIT { } public static void registerItems() { - /*ModItems.itemDebugShapeSpawner = new DEBUG_ITEM_ShapeSpawner("itemDebugShapeSpawner", AddToCreativeTab.tabMisc, 1, 500); - GameRegistry.registerItem(ModItems.itemDebugShapeSpawner, "itemDebugShapeSpawner"); - ModItems.itemBedLocator_Base = new BedLocator_Base("itemBedLocator_Base"); - GameRegistry.registerItem(ModItems.itemBedLocator_Base, "itemBedLocator_Base"); - ModItems.itemBaseItemWithCharge = new BaseItemWithCharge("itemBaseItemWithCharge", 0, 1000); - GameRegistry.registerItem(ModItems.itemBaseItemWithCharge, "itemBaseItemWithCharge");*/ + /* + * ModItems.itemDebugShapeSpawner = new DEBUG_ITEM_ShapeSpawner("itemDebugShapeSpawner", + * AddToCreativeTab.tabMisc, 1, 500); GameRegistry.registerItem(ModItems.itemDebugShapeSpawner, + * "itemDebugShapeSpawner"); ModItems.itemBedLocator_Base = new BedLocator_Base("itemBedLocator_Base"); + * GameRegistry.registerItem(ModItems.itemBedLocator_Base, "itemBedLocator_Base"); + * ModItems.itemBaseItemWithCharge = new BaseItemWithCharge("itemBaseItemWithCharge", 0, 1000); + * GameRegistry.registerItem(ModItems.itemBaseItemWithCharge, "itemBaseItemWithCharge"); + */ } public static void registerTEs() {} diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java index cd8ca0e536..07f8d6385a 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java +++ b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java @@ -2,11 +2,8 @@ package gtPlusPlus.core.util.debug; import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.BaseItemGeneric; import java.util.List; + import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -14,6 +11,11 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.BaseItemGeneric; + public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric { public DEBUG_ITEM_ShapeSpawner(String s, CreativeTabs c, int stackSize, int maxDmg) { @@ -42,7 +44,7 @@ public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric { } } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GOLD + "For Testing Gregtech Shapes!"); diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java index 9cff0758a7..53159a9412 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java +++ b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java @@ -2,6 +2,13 @@ package gtPlusPlus.core.util.debug; import static gregtech.api.enums.GT_Values.V; +import java.util.ArrayList; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; @@ -19,32 +26,14 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; -import java.util.ArrayList; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { public static boolean disableMaintenance; - public boolean mMachine = false, - mWrench = false, - mScrewdriver = false, - mSoftHammer = false, - mHardHammer = false, - mSolderingTool = false, - mCrowbar = false, - mRunningOnLoad = false; - public int mPollution = 0, - mProgresstime = 0, - mMaxProgresstime = 0, - mEUt = 0, - mEfficiencyIncrease = 0, - mUpdate = 0, - mStartUpCheck = 100, - mRuntime = 0, - mEfficiency = 0; + public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, + mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false; + public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mUpdate = 0, + mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; public ItemStack[] mOutputItems = null; public FluidStack[] mOutputFluids = null; public ArrayList mInputHatches = new ArrayList<>(); @@ -58,14 +47,14 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { public DEBUG_MULTIBLOCK_ShapeSpawner(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional, 2); - DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); + DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile + .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); } public DEBUG_MULTIBLOCK_ShapeSpawner(final String aName) { super(aName, 2); - DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile.get( - ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); + DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile + .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); } public static boolean isValidMetaTileEntity(final MetaTileEntity aMetaTileEntity) { @@ -264,13 +253,10 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { if (tStack != null) { try { GT_Mod.achievements.issueAchivementHatch( - aBaseMetaTileEntity - .getWorld() - .getPlayerEntityByName( - aBaseMetaTileEntity.getOwnerName()), + aBaseMetaTileEntity.getWorld().getPlayerEntityByName( + aBaseMetaTileEntity.getOwnerName()), tStack); - } catch (final Exception e) { - } + } catch (final Exception e) {} this.addOutput(tStack); } } @@ -301,8 +287,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 0)) { if (this.mOutputFluids.length > 1) { GT_Mod.achievements.issueAchievement( - aBaseMetaTileEntity - .getWorld() + aBaseMetaTileEntity.getWorld() .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant"); } @@ -310,8 +295,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { } } } else { - if (((aTick % 100) == 0) - || aBaseMetaTileEntity.hasWorkJustBeenEnabled() + if (((aTick % 100) == 0) || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { if (aBaseMetaTileEntity.isAllowedToWork()) { @@ -329,14 +313,14 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { this.stopMachine(); } } - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) - | (this.mWrench ? 0 : 1) - | (this.mScrewdriver ? 0 : 2) - | (this.mSoftHammer ? 0 : 4) - | (this.mHardHammer ? 0 : 8) - | (this.mSolderingTool ? 0 : 16) - | (this.mCrowbar ? 0 : 32) - | (this.mMachine ? 0 : 64)); + aBaseMetaTileEntity.setErrorDisplayID( + (aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (this.mWrench ? 0 : 1) + | (this.mScrewdriver ? 0 : 2) + | (this.mSoftHammer ? 0 : 4) + | (this.mHardHammer ? 0 : 8) + | (this.mSolderingTool ? 0 : 16) + | (this.mCrowbar ? 0 : 32) + | (this.mMachine ? 0 : 64)); aBaseMetaTileEntity.setActive(this.mMaxProgresstime > 0); } } @@ -405,8 +389,8 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { public abstract int getDamageToComponent(ItemStack aStack); /** - * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT. - * This should be the largest Amount that can ever happen legitimately. + * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT. This should be the + * largest Amount that can ever happen legitimately. */ public abstract int getAmountOfOutputs(); @@ -426,8 +410,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { } public int getRepairStatus() { - return (this.mWrench ? 1 : 0) - + (this.mScrewdriver ? 1 : 0) + return (this.mWrench ? 1 : 0) + (this.mScrewdriver ? 1 : 0) + (this.mSoftHammer ? 1 : 0) + (this.mHardHammer ? 1 : 0) + (this.mSolderingTool ? 1 : 0) @@ -467,8 +450,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { break; } } - if ((this.mInventory[1] != null) - && (this.getBaseMetaTileEntity().getRandomNumber(2) == 0) + if ((this.mInventory[1] != null) && (this.getBaseMetaTileEntity().getRandomNumber(2) == 0) && !this.mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { if (this.mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { final NBTTagCompound tNBT = this.mInventory[1].getTagCompound(); @@ -612,8 +594,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { } final FluidStack tLiquid = aLiquid.copy(); for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { - if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) - ? tHatch.outputsSteam() + if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { final int tAmount = tHatch.fill(tLiquid, false); if (tAmount >= tLiquid.amount) { @@ -628,8 +609,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { private void addFluidOutputs(final FluidStack[] mOutputFluids2) { for (int i = 0; i < mOutputFluids2.length; i++) { - if ((this.mOutputHatches.size() > i) - && (this.mOutputHatches.get(i) != null) + if ((this.mOutputHatches.size() > i) && (this.mOutputHatches.get(i) != null) && (mOutputFluids2[i] != null) && isValidMetaTileEntity(this.mOutputHatches.get(i))) { this.mOutputHatches.get(i).fill(mOutputFluids2[i], true); @@ -662,8 +642,8 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { return false; } aStack = GT_Utility.copy(aStack); - // FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); - // if (aLiquid == null) { + // FluidStack aLiquid = GT_Utility.getFluidForFilledItem(aStack, true); + // if (aLiquid == null) { for (final GT_MetaTileEntity_Hatch_OutputBus tHatch : this.mOutputBusses) { if (isValidMetaTileEntity(tHatch)) { for (int i = tHatch.getSizeInventory() - 1; i >= 0; i--) { @@ -680,17 +660,17 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { } } } - // }else { - // for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { - // if (isValidMetaTileEntity(tHatch) && + // }else { + // for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { + // if (isValidMetaTileEntity(tHatch) && // GT_ModHandler.isSteam(aLiquid)?tHatch.outputsSteam():tHatch.outputsLiquids()) { - // int tAmount = tHatch.fill(aLiquid, false); - // if (tAmount >= aLiquid.amount) { - // return tHatch.fill(aLiquid, true) >= aLiquid.amount; - // } - // } - // } - // } + // int tAmount = tHatch.fill(aLiquid, false); + // if (tAmount >= aLiquid.amount) { + // return tHatch.fill(aLiquid, true) >= aLiquid.amount; + // } + // } + // } + // } return false; } @@ -705,8 +685,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { tHatch.mRecipeMap = this.getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { - if (GT_Utility.areStacksEqual( - aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { + if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(0))) { if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); return true; @@ -718,8 +697,7 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { tHatch.mRecipeMap = this.getRecipeMap(); if (isValidMetaTileEntity(tHatch)) { for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (GT_Utility.areStacksEqual( - aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { + if (GT_Utility.areStacksEqual(aStack, tHatch.getBaseMetaTileEntity().getStackInSlot(i))) { if (tHatch.getBaseMetaTileEntity().getStackInSlot(0).stackSize >= aStack.stackSize) { tHatch.getBaseMetaTileEntity().decrStackSize(0, aStack.stackSize); return true; @@ -937,15 +915,9 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { @Override public String[] getInfoData() { - return new String[] { - "Progress:", - (this.mProgresstime / 20) + "secs", - (this.mMaxProgresstime / 20) + "secs", - "Efficiency:", - (this.mEfficiency / 100.0F) + "%", - "Problems:", - "" + (this.getIdealStatus() - this.getRepairStatus()) - }; + return new String[] { "Progress:", (this.mProgresstime / 20) + "secs", (this.mMaxProgresstime / 20) + "secs", + "Efficiency:", (this.mEfficiency / 100.0F) + "%", "Problems:", + "" + (this.getIdealStatus() - this.getRepairStatus()) }; } @Override @@ -954,14 +926,14 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { } @Override - public boolean allowPullStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return false; } @Override - public boolean allowPutStack( - final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { return false; } diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java index de29c35820..16b6979dcb 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java +++ b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ScreenOverlay.java @@ -1,6 +1,5 @@ package gtPlusPlus.core.util.debug; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -8,6 +7,8 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.item.Item; import net.minecraftforge.client.event.RenderGameOverlayEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + public class DEBUG_ScreenOverlay extends Gui { int width, height; @@ -29,17 +30,16 @@ public class DEBUG_ScreenOverlay extends Gui { heldItem = this.mc.thePlayer.getHeldItem().getItem(); if (heldItem != null) { - /*if (heldItem instanceof StaballoyPickaxe){ - - int dmg =((StaballoyPickaxe) heldItem).getDamage(((StaballoyPickaxe) heldItem).thisPickaxe); - - ((StaballoyPickaxe) heldItem).checkFacing(((StaballoyPickaxe) heldItem).localWorld); - str = "DAMAGE: "+ dmg +" | FACING: "+((StaballoyPickaxe) heldItem).FACING+" | FACING_HORIZONTAL: "+((StaballoyPickaxe) heldItem).FACING_HORIZONTAL+" | LOOKING DIRECTION: "+((StaballoyPickaxe) heldItem).lookingDirection; - - drawString(fontRender, str, (this.width - fontRender.getStringWidth(str)) / 2, this.height / 10, 0xFFAA00); - }*/ + /* + * if (heldItem instanceof StaballoyPickaxe){ int dmg =((StaballoyPickaxe) + * heldItem).getDamage(((StaballoyPickaxe) heldItem).thisPickaxe); ((StaballoyPickaxe) + * heldItem).checkFacing(((StaballoyPickaxe) heldItem).localWorld); str = "DAMAGE: "+ dmg + * +" | FACING: "+((StaballoyPickaxe) heldItem).FACING+" | FACING_HORIZONTAL: "+((StaballoyPickaxe) + * heldItem).FACING_HORIZONTAL+" | LOOKING DIRECTION: "+((StaballoyPickaxe) heldItem).lookingDirection; + * drawString(fontRender, str, (this.width - fontRender.getStringWidth(str)) / 2, this.height / 10, + * 0xFFAA00); } + */ } - } catch (final NullPointerException e) { - } + } catch (final NullPointerException e) {} } } diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java index 004657ebcc..fa53c290fc 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java +++ b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java @@ -1,13 +1,15 @@ package gtPlusPlus.core.util.debug; -import gtPlusPlus.api.objects.Logger; import java.util.concurrent.TimeUnit; + import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import gtPlusPlus.api.objects.Logger; + public class DEBUG_TimerThread implements Runnable { private final World world; @@ -26,8 +28,18 @@ public class DEBUG_TimerThread implements Runnable { final int stepX = Minecraft.getMinecraft().objectMouseOver.blockX; final int stepY = Minecraft.getMinecraft().objectMouseOver.blockY; final int stepZ = Minecraft.getMinecraft().objectMouseOver.blockZ; - Logger.INFO("Clicked on a Block @ " + "[X:" + stepX + "][Y:" + stepY + "][Z:" + stepZ + "]" + " with xDir:" - + xDir + " zDir:" + zDir); + Logger.INFO( + "Clicked on a Block @ " + "[X:" + + stepX + + "][Y:" + + stepY + + "][Z:" + + stepZ + + "]" + + " with xDir:" + + xDir + + " zDir:" + + zDir); this.world.setBlock(stepX, stepY, stepZ, Blocks.bedrock, 0, 3); Logger.INFO("Makng it Bedrock for future investment."); // for (int i = -1; i <= 1; i++) { @@ -43,8 +55,18 @@ public class DEBUG_TimerThread implements Runnable { // stepZ = stepZ+j; // for (int h = -1; h <= 1; h++) { // stepY = stepY+h; - Logger.INFO("Placing Block @ " + "[X:" + i + "][Y:" + h + "][Z:" + j + "]" + " with xDir:" + xDir - + " zDir:" + zDir); + Logger.INFO( + "Placing Block @ " + "[X:" + + i + + "][Y:" + + h + + "][Z:" + + j + + "]" + + " with xDir:" + + xDir + + " zDir:" + + zDir); if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { this.world.setBlock(i, h, j, Blocks.stone, 0, 3); } else { diff --git a/src/main/java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java b/src/main/java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java index cf3580f5b7..e774824fbf 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java +++ b/src/main/java/gtPlusPlus/core/util/debug/UtilityGL11Debug.java @@ -1,21 +1,19 @@ package gtPlusPlus.core.util.debug; import java.nio.ByteBuffer; + import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; /** - * User: The Grey Ghost - * Date: 9/02/14 + * User: The Grey Ghost Date: 9/02/14 */ public class UtilityGL11Debug { + public class GLproperty { - public GLproperty( - final int init_gLconstant, - final String init_name, - final String init_description, - final String init_category, - final String init_fetchCommand) { + + public GLproperty(final int init_gLconstant, final String init_name, final String init_description, + final String init_category, final String init_fetchCommand) { this.gLconstant = init_gLconstant; this.name = init_name; this.description = init_description; @@ -33,1064 +31,1265 @@ public class UtilityGL11Debug { public static UtilityGL11Debug instance = new UtilityGL11Debug(); public GLproperty[] propertyList = { - new GLproperty(GL11.GL_CURRENT_COLOR, "GL_CURRENT_COLOR", "Current color", "current", "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_INDEX, "GL_CURRENT_INDEX", "Current color index", "current", "glGetFloatv()"), - new GLproperty( - GL11.GL_CURRENT_TEXTURE_COORDS, - "GL_CURRENT_TEXTURE_COORDS", - "Current texture coordinates", - "current", - "glGetFloatv()"), - new GLproperty(GL11.GL_CURRENT_NORMAL, "GL_CURRENT_NORMAL", "Current normal", "current", "glGetFloatv()"), - new GLproperty( - GL11.GL_CURRENT_RASTER_POSITION, - "GL_CURRENT_RASTER_POSITION", - "Current raster position", - "current", - "glGetFloatv()"), - new GLproperty( - GL11.GL_CURRENT_RASTER_DISTANCE, - "GL_CURRENT_RASTER_DISTANCE", - "Current raster distance", - "current", - "glGetFloatv()"), - new GLproperty( - GL11.GL_CURRENT_RASTER_COLOR, - "GL_CURRENT_RASTER_COLOR", - "Color associated with raster position", - "current", - "glGetFloatv()"), - new GLproperty( - GL11.GL_CURRENT_RASTER_INDEX, - "GL_CURRENT_RASTER_INDEX", - "Color index associated with raster position", - "current", - "glGetFloatv()"), - new GLproperty( - GL11.GL_CURRENT_RASTER_TEXTURE_COORDS, - "GL_CURRENT_RASTER_TEXTURE_COORDS", - "Texture coordinates associated with raster position", - "current", - "glGetFloatv()"), - new GLproperty( - GL11.GL_CURRENT_RASTER_POSITION_VALID, - "GL_CURRENT_RASTER_POSITION_VALID", - "Raster position valid bit", - "current", - "glGetBooleanv()"), - new GLproperty(GL11.GL_EDGE_FLAG, "GL_EDGE_FLAG", "Edge flag", "current", "glGetBooleanv()"), - new GLproperty(GL11.GL_VERTEX_ARRAY, "GL_VERTEX_ARRAY", "Vertex array enable", "vertex-array", "glIsEnabled()"), - new GLproperty( - GL11.GL_VERTEX_ARRAY_SIZE, - "GL_VERTEX_ARRAY_SIZE", - "Coordinates per vertex", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_VERTEX_ARRAY_TYPE, - "GL_VERTEX_ARRAY_TYPE", - "Type of vertex coordinates", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_VERTEX_ARRAY_STRIDE, - "GL_VERTEX_ARRAY_STRIDE", - "Stride between vertices", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_VERTEX_ARRAY_POINTER, - "GL_VERTEX_ARRAY_POINTER", - "Pointer to the vertex array", - "vertex-array", - "glGetPointerv()"), - new GLproperty(GL11.GL_NORMAL_ARRAY, "GL_NORMAL_ARRAY", "Normal array enable", "vertex-array", "glIsEnabled()"), - new GLproperty( - GL11.GL_NORMAL_ARRAY_TYPE, - "GL_NORMAL_ARRAY_TYPE", - "Type of normal coordinates", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_NORMAL_ARRAY_STRIDE, - "GL_NORMAL_ARRAY_STRIDE", - "Stride between normals", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_NORMAL_ARRAY_POINTER, - "GL_NORMAL_ARRAY_POINTER", - "Pointer to the normal array", - "vertex-array", - "glGetPointerv()"), - new GLproperty( - GL11.GL_COLOR_ARRAY, "GL_COLOR_ARRAY", "RGBA color array enable", "vertex-array", "glIsEnabled()"), - new GLproperty( - GL11.GL_COLOR_ARRAY_SIZE, - "GL_COLOR_ARRAY_SIZE", - "Colors per vertex", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_COLOR_ARRAY_TYPE, - "GL_COLOR_ARRAY_TYPE", - "Type of color components", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_COLOR_ARRAY_STRIDE, - "GL_COLOR_ARRAY_STRIDE", - "Stride between colors", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_COLOR_ARRAY_POINTER, - "GL_COLOR_ARRAY_POINTER", - "Pointer to the color array", - "vertex-array", - "glGetPointerv()"), - new GLproperty( - GL11.GL_INDEX_ARRAY, "GL_INDEX_ARRAY", "Color-index array enable", "vertex-array", "glIsEnabled()"), - new GLproperty( - GL11.GL_INDEX_ARRAY_TYPE, - "GL_INDEX_ARRAY_TYPE", - "Type of color indices", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_INDEX_ARRAY_STRIDE, - "GL_INDEX_ARRAY_STRIDE", - "Stride between color indices", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_INDEX_ARRAY_POINTER, - "GL_INDEX_ARRAY_POINTER", - "Pointer to the index array", - "vertex-array", - "glGetPointerv()"), - new GLproperty( - GL11.GL_TEXTURE_COORD_ARRAY, - "GL_TEXTURE_COORD_ARRAY", - "Texture coordinate array enable", - "vertex-array", - "glIsEnabled()"), - new GLproperty( - GL11.GL_TEXTURE_COORD_ARRAY_SIZE, - "GL_TEXTURE_COORD_ARRAY_SIZE", - "Texture coordinates per element", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_TEXTURE_COORD_ARRAY_TYPE, - "GL_TEXTURE_COORD_ARRAY_TYPE", - "Type of texture coordinates", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_TEXTURE_COORD_ARRAY_STRIDE, - "GL_TEXTURE_COORD_ARRAY_STRIDE", - "Stride between texture coordinates", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_TEXTURE_COORD_ARRAY_POINTER, - "GL_TEXTURE_COORD_ARRAY_POINTER", - "Pointer to the texture coordinate array", - "vertex-array", - "glGetPointerv()"), - new GLproperty( - GL11.GL_EDGE_FLAG_ARRAY, - "GL_EDGE_FLAG_ARRAY", - "Edge flag array enable", - "vertex-array", - "glIsEnabled()"), - new GLproperty( - GL11.GL_EDGE_FLAG_ARRAY_STRIDE, - "GL_EDGE_FLAG_ARRAY_STRIDE", - "Stride between edge flags", - "vertex-array", - "glGetIntegerv()"), - new GLproperty( - GL11.GL_EDGE_FLAG_ARRAY_POINTER, - "GL_EDGE_FLAG_ARRAY_POINTER", - "Pointer to the edge flag array", - "vertex-array", - "glGetPointerv()"), - new GLproperty( - GL11.GL_MODELVIEW_MATRIX, "GL_MODELVIEW_MATRIX", "Modelview matrix stack", "matrix", "glGetFloatv()"), - new GLprope