From 7d1f51a8937e0a86486267437d444696e81e8aa0 Mon Sep 17 00:00:00 2001 From: Jakub <53441451+kuba6000@users.noreply.github.com> Date: Mon, 29 Aug 2022 16:04:28 +0200 Subject: Buildscript + Spotless (#318) * Convert AES.java to readable class * Buildscript * Spotless --- .../gtPlusPlus/api/damage/DamageTeslaTower.java | 26 +- .../java/gtPlusPlus/api/enums/ParticleNames.java | 64 +- src/main/java/gtPlusPlus/api/enums/Quality.java | 111 +-- .../api/helpers/GregtechPlusPlus_API.java | 387 +++++------ .../gtPlusPlus/api/helpers/MaterialHelper.java | 151 ++-- .../gtPlusPlus/api/interfaces/IChunkLoader.java | 48 +- .../api/interfaces/IComparableRecipe.java | 5 +- .../gtPlusPlus/api/interfaces/IEntityCatcher.java | 22 +- .../gtPlusPlus/api/interfaces/IGeneratorWorld.java | 21 +- .../api/interfaces/IGregtechPacketEntity.java | 5 +- .../gtPlusPlus/api/interfaces/IGregtechPower.java | 184 +++-- .../gtPlusPlus/api/interfaces/ILazyCoverable.java | 265 ++++--- .../java/gtPlusPlus/api/interfaces/IPlugin.java | 70 +- .../api/interfaces/IRandomGenerator.java | 1 - .../gtPlusPlus/api/interfaces/ITexturedBlock.java | 10 +- .../gtPlusPlus/api/interfaces/ITileTooltip.java | 3 +- .../java/gtPlusPlus/api/interfaces/IToolable.java | 29 +- .../api/interfaces/RunnableWithInfo.java | 12 +- .../gtPlusPlus/api/objects/GregtechException.java | 39 +- src/main/java/gtPlusPlus/api/objects/Logger.java | 310 ++++----- .../java/gtPlusPlus/api/objects/data/AutoMap.java | 669 +++++++++--------- .../api/objects/data/ConcurrentHashSet.java | 19 +- .../gtPlusPlus/api/objects/data/ConcurrentSet.java | 10 +- .../gtPlusPlus/api/objects/data/FlexiblePair.java | 67 +- .../java/gtPlusPlus/api/objects/data/ObjMap.java | 278 ++++---- .../java/gtPlusPlus/api/objects/data/Pair.java | 49 +- .../java/gtPlusPlus/api/objects/data/Quad.java | 79 ++- .../api/objects/data/ReverseAutoMap.java | 333 +++++---- .../java/gtPlusPlus/api/objects/data/Triplet.java | 39 +- .../gtPlusPlus/api/objects/data/TypeCounter.java | 331 +++++---- .../api/objects/data/WeightedCollection.java | 180 +++-- .../api/objects/data/weakref/WeakAutoMap.java | 12 +- .../gtPlusPlus/api/objects/minecraft/AABB.java | 97 ++- .../api/objects/minecraft/BTF_FluidTank.java | 353 +++++----- .../api/objects/minecraft/BTF_Inventory.java | 446 ++++++------ .../gtPlusPlus/api/objects/minecraft/BlockPos.java | 473 +++++++------ .../api/objects/minecraft/CubicObject.java | 101 ++- .../api/objects/minecraft/DimChunkPos.java | 78 ++- .../api/objects/minecraft/FakeBlockPos.java | 434 ++++++------ .../api/objects/minecraft/FakeWorld.java | 292 ++++---- .../gtPlusPlus/api/objects/minecraft/FluidGT6.java | 42 +- .../objects/minecraft/FormattedTooltipString.java | 38 +- .../api/objects/minecraft/GenericStack.java | 67 +- .../api/objects/minecraft/ItemPackage.java | 97 ++- .../api/objects/minecraft/ItemStackData.java | 50 +- .../objects/minecraft/NoConflictGTRecipeMap.java | 225 +++--- .../api/objects/minecraft/SafeTexture.java | 92 ++- .../api/objects/minecraft/ShapedRecipe.java | 472 +++++++------ .../api/objects/minecraft/TexturePackage.java | 89 ++- .../api/objects/minecraft/ThreadPooCollector.java | 174 +++-- .../minecraft/multi/NoEUBonusMultiBehaviour.java | 31 +- .../multi/NoOutputBonusMultiBehaviour.java | 31 +- .../multi/NoSpeedBonusMultiBehaviour.java | 31 +- .../minecraft/multi/SpecialMultiBehaviour.java | 57 +- .../api/objects/random/CSPRNG_DO_NOT_USE.java | 136 ++-- .../api/objects/random/UUIDGenerator.java | 761 ++++++++++----------- .../java/gtPlusPlus/api/objects/random/XSTR.java | 441 ++++++------ .../java/gtPlusPlus/api/plugin/Sample_Plugin.java | 77 +-- .../api/thermal/energy/IThermalConnection.java | 4 +- .../api/thermal/energy/IThermalContainerItem.java | 13 +- .../api/thermal/energy/IThermalHandler.java | 13 +- .../api/thermal/energy/IThermalProvider.java | 11 +- .../api/thermal/energy/IThermalReceiver.java | 11 +- .../api/thermal/energy/IThermalStorage.java | 13 +- .../api/thermal/energy/ThermalStorage.java | 219 +++--- .../api/thermal/energy/ThermalStorageAdv.java | 62 +- .../api/thermal/sample/ItemThermalContainer.java | 127 ++-- .../api/thermal/sample/TileThermalHandler.java | 66 +- .../api/thermal/tileentity/IThermalInfo.java | 13 +- 69 files changed, 4704 insertions(+), 4862 deletions(-) (limited to 'src/main/java/gtPlusPlus/api') diff --git a/src/main/java/gtPlusPlus/api/damage/DamageTeslaTower.java b/src/main/java/gtPlusPlus/api/damage/DamageTeslaTower.java index f35c9cbc6b..e37a86aaa5 100644 --- a/src/main/java/gtPlusPlus/api/damage/DamageTeslaTower.java +++ b/src/main/java/gtPlusPlus/api/damage/DamageTeslaTower.java @@ -1,24 +1,22 @@ package gtPlusPlus.api.damage; +import gtPlusPlus.core.world.damage.BaseCustomDamageSource; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.IChatComponent; -import gtPlusPlus.core.world.damage.BaseCustomDamageSource; - -public class DamageTeslaTower extends BaseCustomDamageSource{ +public class DamageTeslaTower extends BaseCustomDamageSource { - public DamageTeslaTower(Entity transmitter) { - super("plasmabolt", transmitter, null); - this.setDamageBypassesArmor(); - this.setDamageIsAbsolute(); - } - - @Override - public IChatComponent func_151519_b(EntityLivingBase target) { - String s = "death.attack." + this.damageType; - return new ChatComponentTranslation(s, target.getCommandSenderName(), "Plasma"); - } + public DamageTeslaTower(Entity transmitter) { + super("plasmabolt", transmitter, null); + this.setDamageBypassesArmor(); + this.setDamageIsAbsolute(); + } + @Override + public IChatComponent func_151519_b(EntityLivingBase target) { + String s = "death.attack." + this.damageType; + return new ChatComponentTranslation(s, target.getCommandSenderName(), "Plasma"); + } } diff --git a/src/main/java/gtPlusPlus/api/enums/ParticleNames.java b/src/main/java/gtPlusPlus/api/enums/ParticleNames.java index d082cd6779..335442dbc7 100644 --- a/src/main/java/gtPlusPlus/api/enums/ParticleNames.java +++ b/src/main/java/gtPlusPlus/api/enums/ParticleNames.java @@ -1,37 +1,35 @@ package gtPlusPlus.api.enums; public enum ParticleNames { - - explode, - largeexplode, - hugeexplosion, - bubble, - splash, - suspended, - depthsuspend, - crit, - magicCrit, - smoke, - largesmoke, - spell, - instantSpell, - mobSpell, - dripWater, - dripLava, - townaura, - note, - portal, - enchantmenttable, - flame, - lava, - footstep, - cloud, - reddust, - snowballpoof, - snowshovel, - slime, - heart, - iconcrack_, - tilecrack_; - + explode, + largeexplode, + hugeexplosion, + bubble, + splash, + suspended, + depthsuspend, + crit, + magicCrit, + smoke, + largesmoke, + spell, + instantSpell, + mobSpell, + dripWater, + dripLava, + townaura, + note, + portal, + enchantmenttable, + flame, + lava, + footstep, + cloud, + reddust, + snowballpoof, + snowshovel, + slime, + heart, + iconcrack_, + tilecrack_; } diff --git a/src/main/java/gtPlusPlus/api/enums/Quality.java b/src/main/java/gtPlusPlus/api/enums/Quality.java index 050f335b5e..d6f0667e20 100644 --- a/src/main/java/gtPlusPlus/api/enums/Quality.java +++ b/src/main/java/gtPlusPlus/api/enums/Quality.java @@ -1,62 +1,65 @@ package gtPlusPlus.api.enums; -import net.minecraft.util.EnumChatFormatting; - import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.util.EnumChatFormatting; public enum Quality { - // Magic Blue - // Rare Yellow - // Set Green - // Unique Gold/Purple - // Trade-off Brown - - POOR("Poor", EnumChatFormatting.GRAY), COMMON("Common", EnumChatFormatting.WHITE), UNCOMMON("Uncommon", - EnumChatFormatting.DARK_GREEN), MAGIC("Magic", EnumChatFormatting.BLUE), RARE("Rare", - EnumChatFormatting.YELLOW), UNIQUE("Unique", EnumChatFormatting.GOLD), ARTIFACT("Artifact", - EnumChatFormatting.AQUA), SET("Set Piece", EnumChatFormatting.GREEN), TRADEOFF("Trade-off", - EnumChatFormatting.DARK_RED), EPIC("Epic", EnumChatFormatting.LIGHT_PURPLE); - - private String LOOT; - private EnumChatFormatting COLOUR; - - private Quality(final String lootTier, final EnumChatFormatting tooltipColour) { - this.LOOT = lootTier; - this.COLOUR = tooltipColour; - } - - public String getQuality() { - return this.LOOT; - } - - protected EnumChatFormatting getColour() { - return this.COLOUR; - } - - public String formatted() { - return this.COLOUR + this.LOOT; - } - - public static Quality getRandomQuality() { - final int lootChance = MathUtils.randInt(0, 100); - if (lootChance <= 10) { - return Quality.POOR; - } else if (lootChance <= 45) { - return Quality.COMMON; - } else if (lootChance <= 65) { - return Quality.UNCOMMON; - } else if (lootChance <= 82) { - return Quality.MAGIC; - } else if (lootChance <= 92) { - return Quality.EPIC; - } else if (lootChance <= 97) { - return Quality.RARE; - } else if (lootChance <= 99) { - return Quality.ARTIFACT; - } else { - return null; - } - } + // Magic Blue + // Rare Yellow + // Set Green + // Unique Gold/Purple + // Trade-off Brown + + POOR("Poor", EnumChatFormatting.GRAY), + COMMON("Common", EnumChatFormatting.WHITE), + UNCOMMON("Uncommon", EnumChatFormatting.DARK_GREEN), + MAGIC("Magic", EnumChatFormatting.BLUE), + RARE("Rare", EnumChatFormatting.YELLOW), + UNIQUE("Unique", EnumChatFormatting.GOLD), + ARTIFACT("Artifact", EnumChatFormatting.AQUA), + SET("Set Piece", EnumChatFormatting.GREEN), + TRADEOFF("Trade-off", EnumChatFormatting.DARK_RED), + EPIC("Epic", EnumChatFormatting.LIGHT_PURPLE); + + private String LOOT; + private EnumChatFormatting COLOUR; + + private Quality(final String lootTier, final EnumChatFormatting tooltipColour) { + this.LOOT = lootTier; + this.COLOUR = tooltipColour; + } + + public String getQuality() { + return this.LOOT; + } + + protected EnumChatFormatting getColour() { + return this.COLOUR; + } + + public String formatted() { + return this.COLOUR + this.LOOT; + } + public static Quality getRandomQuality() { + final int lootChance = MathUtils.randInt(0, 100); + if (lootChance <= 10) { + return Quality.POOR; + } else if (lootChance <= 45) { + return Quality.COMMON; + } else if (lootChance <= 65) { + return Quality.UNCOMMON; + } else if (lootChance <= 82) { + return Quality.MAGIC; + } else if (lootChance <= 92) { + return Quality.EPIC; + } else if (lootChance <= 97) { + return Quality.RARE; + } else if (lootChance <= 99) { + return Quality.ARTIFACT; + } else { + return null; + } + } } diff --git a/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java b/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java index 5cf323c7e2..99e14cae01 100644 --- a/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java +++ b/src/main/java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java @@ -1,7 +1,5 @@ package gtPlusPlus.api.helpers; -import java.util.HashMap; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.WeightedCollection; import gtPlusPlus.api.objects.minecraft.multi.SpecialMultiBehaviour; @@ -9,205 +7,198 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy_RTG; import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler; +import java.util.HashMap; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; public class GregtechPlusPlus_API { - - - public static class MolecularTransformer_API { - - public static boolean addRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU) { - return CORE.RA.addMolecularTransformerRecipe(aInput, aOutput, aDuration, aEU, 1); - } - - } - - public static class Multiblock_API { - - private static final HashMap mSpecialBehaviourItemMap = new HashMap(); - - /** - * Register a special behaviour for GT++ Multis to listen use. - * @param aBehaviour - An Object which has extended {@link SpecialMultiBehaviour}'s base implementation. - * @return - Did this behaviour register properly? - */ - public static boolean registerSpecialMultiBehaviour(SpecialMultiBehaviour aBehaviour) { - if (aBehaviour.getTriggerItem() == null || aBehaviour.getTriggerItemTooltip() == null || aBehaviour.getTriggerItemTooltip().length() <= 0) { - Logger.INFO("Failed to attach custom multiblock logic to "+ItemUtils.getItemName(aBehaviour.getTriggerItem())); - return false; - } - mSpecialBehaviourItemMap.put("UniqueKey_"+aBehaviour.hashCode(), aBehaviour); - SpecialBehaviourTooltipHandler.addTooltipForItem(aBehaviour.getTriggerItem(), aBehaviour.getTriggerItemTooltip()); - Logger.INFO("Attached custom multiblock logic to "+ItemUtils.getItemName(aBehaviour.getTriggerItem())); - return true; - } - - public static final HashMap getSpecialBehaviourItemMap() { - return mSpecialBehaviourItemMap; - } - - /** - * Allows RTG Fuel pellets from other mods to be used in the RTG hatch. - * @param aStack - The Pellet Stack, sanitsed after passing through. - * @param aFuelValue - The Fuel Value of the Pellet to be added to the energy storage. - * @return - Did register? - */ - public static boolean registerPelletForRtgHatch(ItemStack aStack, long aFuelValue) { - return GT_MetaTileEntity_Hatch_Energy_RTG.registerPelletForHatch(aStack, aFuelValue); - } - - } - - public static class VoidMiner_API { - - private static final HashMap>> mMinerLootCache; - - static { - mMinerLootCache = new HashMap>>(); - } - - - /** - * - * Registers an ore block for a dimension. Uses a default weight of 100. - * @param aDim - The Dimension ID - * @param aOredictName - The OreDict name of the Ore to be mined. - * @return - If there was a valid Block found in the OreDict for the provided name. - */ - public static boolean registerOreForVoidMiner(int aDim, String aOredictName) { - return registerOreForVoidMiner(aDim, aOredictName, 100); - } - - /** - * - * Registers an ore block for a dimension. Uses a default weight of 100. - * @param aDim - The Dimension ID - * @param aOredictName - The OreDict name of the Ore to be mined. - * @param aWeight - The weight of this ore Block. - * @return - If there was a valid Block found in the OreDict for the provided name. - */ - public static boolean registerOreForVoidMiner(int aDim, String aOredictName, int aWeight) { - Block b = null; - ItemStack[] aValidItems = ItemUtils.validItemsForOreDict(aOredictName); - for (ItemStack g : aValidItems) { - if (g != null) { - b = Block.getBlockFromItem(g.getItem()); - if (b != null) { - break; - } - } - } - if (b != null) { - registerOreForVoidMiner(aDim, b, aWeight); - return true; - } - return false; - } - - - /** - * Registers an ore block for a dimension. Uses a default weight of 100. - * @param aDim - The Dimension ID - * @param aOreBlock - The Ore Block to be mined. - */ - public static void registerOreForVoidMiner(int aDim, Block aOreBlock) { - registerOreForVoidMiner(aDim, aOreBlock, 100); - } - - /** - * Registers an ore block for a dimension. - * @param aDim - The Dimension ID - * @param aOreBlock - The Ore Block to be mined. - * @param aWeight - The weight of this ore Block. - */ - public static void registerOreForVoidMiner(int aDim, Block aOreBlock, int aWeight) { - GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aOreBlock, aWeight); - } - - /** - * Registers a surface block for a dimension. Uses a default weight of 100. - * @param aDim - The Dimension ID - * @param aDirtBlock - The Dirt/Grass Block to be mined. - */ - public static void registerEarthSurfaceForVoidMiner(int aDim, Block aDirtBlock) { - registerEarthSurfaceForVoidMiner(aDim, aDirtBlock, 100); - } - - /** - * Registers a surface block for a dimension. - * @param aDim - The Dimension ID - * @param aDirtBlock - The Dirt/Grass Block to be mined. - * @param aWeight - The weight of this Dirt/Grass Block. - */ - public static void registerEarthSurfaceForVoidMiner(int aDim, Block aDirtBlock, int aWeight) { - GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aDirtBlock, aWeight); - } - - /** - * Registers a stone block for a dimension. Uses a default weight of 100. - * @param aDim - The Dimension ID - * @param aStoneBlock - The Stone Block to be mined. - */ - public static void registerEarthStoneForVoidMiner(int aDim, Block aStoneBlock) { - registerEarthStoneForVoidMiner(aDim, aStoneBlock, 100); - } - - /** - * Registers a stone block for a dimension. - * @param aDim - The Dimension ID - * @param aStoneBlock - The Stone Block to be mined. - * @param aWeight - The weight of this Stone Block. - */ - public static void registerEarthStoneForVoidMiner(int aDim, Block aStoneBlock, int aWeight) { - GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aStoneBlock, aWeight); - } - - - - - public static WeightedCollection getAllRegisteredOresForDimension(int aDim) { - return mMinerLootCache.get(aDim).get("ore"); - } - - public static WeightedCollection getAllRegisteredDirtTypesForDimension(int aDim) { - return mMinerLootCache.get(aDim).get("dirt"); - } - - public static WeightedCollection getAllRegisteredStoneTypesForDimension(int aDim) { - return mMinerLootCache.get(aDim).get("stone"); - } - - public static final HashMap>> getVoidMinerLootCache() { - return mMinerLootCache; - } - - } - - - private static class GregtechPlusPlus_API_Internal { - - private static void writeBlockToDimensionInCache(int aDim, int aType, Block aBlock, int aWeight) { - HashMap> aDimMap = VoidMiner_API.mMinerLootCache.get(aDim); - if (aDimMap == null) { - aDimMap = new HashMap>(); - } - WeightedCollection aMappedBlocks = getBlockMap(aType, aDimMap); - aMappedBlocks.put(aWeight, aBlock); - - } - - private static WeightedCollection getBlockMap(int aType, HashMap> aDimMap){ - WeightedCollection aMappedBlocks; - String aTypeName = ((aType == 0) ? "ore" : (aType == 1) ? "dirt" : (aType == 2) ? "stone" : "error"); - aMappedBlocks = aDimMap.get(aTypeName); - if (aMappedBlocks == null) { - aMappedBlocks = new WeightedCollection(); - } - return aMappedBlocks; - } - - } - + public static class MolecularTransformer_API { + + public static boolean addRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEU) { + return CORE.RA.addMolecularTransformerRecipe(aInput, aOutput, aDuration, aEU, 1); + } + } + + public static class Multiblock_API { + + private static final HashMap mSpecialBehaviourItemMap = + new HashMap(); + + /** + * Register a special behaviour for GT++ Multis to listen use. + * @param aBehaviour - An Object which has extended {@link SpecialMultiBehaviour}'s base implementation. + * @return - Did this behaviour register properly? + */ + public static boolean registerSpecialMultiBehaviour(SpecialMultiBehaviour aBehaviour) { + if (aBehaviour.getTriggerItem() == null + || aBehaviour.getTriggerItemTooltip() == null + || aBehaviour.getTriggerItemTooltip().length() <= 0) { + Logger.INFO("Failed to attach custom multiblock logic to " + + ItemUtils.getItemName(aBehaviour.getTriggerItem())); + return false; + } + mSpecialBehaviourItemMap.put("UniqueKey_" + aBehaviour.hashCode(), aBehaviour); + SpecialBehaviourTooltipHandler.addTooltipForItem( + aBehaviour.getTriggerItem(), aBehaviour.getTriggerItemTooltip()); + Logger.INFO("Attached custom multiblock logic to " + ItemUtils.getItemName(aBehaviour.getTriggerItem())); + return true; + } + + public static final HashMap getSpecialBehaviourItemMap() { + return mSpecialBehaviourItemMap; + } + + /** + * Allows RTG Fuel pellets from other mods to be used in the RTG hatch. + * @param aStack - The Pellet Stack, sanitsed after passing through. + * @param aFuelValue - The Fuel Value of the Pellet to be added to the energy storage. + * @return - Did register? + */ + public static boolean registerPelletForRtgHatch(ItemStack aStack, long aFuelValue) { + return GT_MetaTileEntity_Hatch_Energy_RTG.registerPelletForHatch(aStack, aFuelValue); + } + } + + public static class VoidMiner_API { + + private static final HashMap>> mMinerLootCache; + + static { + mMinerLootCache = new HashMap>>(); + } + + /** + * + * Registers an ore block for a dimension. Uses a default weight of 100. + * @param aDim - The Dimension ID + * @param aOredictName - The OreDict name of the Ore to be mined. + * @return - If there was a valid Block found in the OreDict for the provided name. + */ + public static boolean registerOreForVoidMiner(int aDim, String aOredictName) { + return registerOreForVoidMiner(aDim, aOredictName, 100); + } + + /** + * + * Registers an ore block for a dimension. Uses a default weight of 100. + * @param aDim - The Dimension ID + * @param aOredictName - The OreDict name of the Ore to be mined. + * @param aWeight - The weight of this ore Block. + * @return - If there was a valid Block found in the OreDict for the provided name. + */ + public static boolean registerOreForVoidMiner(int aDim, String aOredictName, int aWeight) { + Block b = null; + ItemStack[] aValidItems = ItemUtils.validItemsForOreDict(aOredictName); + for (ItemStack g : aValidItems) { + if (g != null) { + b = Block.getBlockFromItem(g.getItem()); + if (b != null) { + break; + } + } + } + if (b != null) { + registerOreForVoidMiner(aDim, b, aWeight); + return true; + } + return false; + } + + /** + * Registers an ore block for a dimension. Uses a default weight of 100. + * @param aDim - The Dimension ID + * @param aOreBlock - The Ore Block to be mined. + */ + public static void registerOreForVoidMiner(int aDim, Block aOreBlock) { + registerOreForVoidMiner(aDim, aOreBlock, 100); + } + + /** + * Registers an ore block for a dimension. + * @param aDim - The Dimension ID + * @param aOreBlock - The Ore Block to be mined. + * @param aWeight - The weight of this ore Block. + */ + public static void registerOreForVoidMiner(int aDim, Block aOreBlock, int aWeight) { + GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aOreBlock, aWeight); + } + + /** + * Registers a surface block for a dimension. Uses a default weight of 100. + * @param aDim - The Dimension ID + * @param aDirtBlock - The Dirt/Grass Block to be mined. + */ + public static void registerEarthSurfaceForVoidMiner(int aDim, Block aDirtBlock) { + registerEarthSurfaceForVoidMiner(aDim, aDirtBlock, 100); + } + + /** + * Registers a surface block for a dimension. + * @param aDim - The Dimension ID + * @param aDirtBlock - The Dirt/Grass Block to be mined. + * @param aWeight - The weight of this Dirt/Grass Block. + */ + public static void registerEarthSurfaceForVoidMiner(int aDim, Block aDirtBlock, int aWeight) { + GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aDirtBlock, aWeight); + } + + /** + * Registers a stone block for a dimension. Uses a default weight of 100. + * @param aDim - The Dimension ID + * @param aStoneBlock - The Stone Block to be mined. + */ + public static void registerEarthStoneForVoidMiner(int aDim, Block aStoneBlock) { + registerEarthStoneForVoidMiner(aDim, aStoneBlock, 100); + } + + /** + * Registers a stone block for a dimension. + * @param aDim - The Dimension ID + * @param aStoneBlock - The Stone Block to be mined. + * @param aWeight - The weight of this Stone Block. + */ + public static void registerEarthStoneForVoidMiner(int aDim, Block aStoneBlock, int aWeight) { + GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aStoneBlock, aWeight); + } + + public static WeightedCollection getAllRegisteredOresForDimension(int aDim) { + return mMinerLootCache.get(aDim).get("ore"); + } + + public static WeightedCollection getAllRegisteredDirtTypesForDimension(int aDim) { + return mMinerLootCache.get(aDim).get("dirt"); + } + + public static WeightedCollection getAllRegisteredStoneTypesForDimension(int aDim) { + return mMinerLootCache.get(aDim).get("stone"); + } + + public static final HashMap>> getVoidMinerLootCache() { + return mMinerLootCache; + } + } + + private static class GregtechPlusPlus_API_Internal { + + private static void writeBlockToDimensionInCache(int aDim, int aType, Block aBlock, int aWeight) { + HashMap> aDimMap = VoidMiner_API.mMinerLootCache.get(aDim); + if (aDimMap == null) { + aDimMap = new HashMap>(); + } + WeightedCollection aMappedBlocks = getBlockMap(aType, aDimMap); + aMappedBlocks.put(aWeight, aBlock); + } + + private static WeightedCollection getBlockMap( + int aType, HashMap> aDimMap) { + WeightedCollection aMappedBlocks; + String aTypeName = ((aType == 0) ? "ore" : (aType == 1) ? "dirt" : (aType == 2) ? "stone" : "error"); + aMappedBlocks = aDimMap.get(aTypeName); + if (aMappedBlocks == null) { + aMappedBlocks = new WeightedCollection(); + } + return aMappedBlocks; + } + } } diff --git a/src/main/java/gtPlusPlus/api/helpers/MaterialHelper.java b/src/main/java/gtPlusPlus/api/helpers/MaterialHelper.java index 9d2e894d99..3f14a9de03 100644 --- a/src/main/java/gtPlusPlus/api/helpers/MaterialHelper.java +++ b/src/main/java/gtPlusPlus/api/helpers/MaterialHelper.java @@ -1,76 +1,103 @@ package gtPlusPlus.api.helpers; -import net.minecraft.item.ItemStack; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import net.minecraft.item.ItemStack; public class MaterialHelper { - public static ItemStack getComponentFromMaterial(OrePrefixes oreprefix, Material material, int amount){ - return ItemUtils.getOrePrefixStack(oreprefix, material, amount); - } - public static ItemStack getComponentFromGtMaterial(OrePrefixes oreprefix, Materials material, int amount){ - return ItemUtils.getGregtechOreStack(oreprefix, material, amount); - } - - /** - * Generates a 16 Fluid Pipe - * @see {@code Example: Copper 16x Pipe (Materials.Copper, Materials.Copper.mName, "Copper", ID, 60, 1000, true)} - * @param aMaterial - Pipe Material - * @param name - Pipe Internal name - * @param displayName - Pipe Display Name - * @param aID - Pipe's Meta ID - * @param baseCapacity - Pipes Base Capacity - * @param heatCapacity - Pipe Max Temp - * @param gasProof - Is Gas Proof? - * @return A boolean which corresponds to whether or not the Pipe was registered to the Ore Dictionary. - */ - public static boolean generateHexadecuplePipe(Materials aMaterial, String name, String displayName, int aID, - int baseCapacity, int heatCapacity, boolean gasProof) { - if (Utils.getGregtechVersionAsInt() >= 50930) { - try { - Class aPipeEntity = GT_MetaPipeEntity_Fluid.class; - Constructor constructor = aPipeEntity - .getConstructor(new Class[] { int.class, String.class, String.class, float.class, - Materials.class, int.class, int.class, boolean.class, int.class }); - if (constructor != null) { - GT_MetaPipeEntity_Fluid aPipe; - aPipe = constructor.newInstance(aID, "GT_Pipe_" + name + "_Hexadecuple", - "Hexadecuple " + displayName + " Fluid Pipe", 1.0F, aMaterial, baseCapacity, heatCapacity, - gasProof, 16); - return GT_OreDictUnificator.registerOre("pipeHexadecuple" + aMaterial, aPipe.getStackForm(1L)); - } + public static ItemStack getComponentFromMaterial(OrePrefixes oreprefix, Material material, int amount) { + return ItemUtils.getOrePrefixStack(oreprefix, material, amount); + } + + public static ItemStack getComponentFromGtMaterial(OrePrefixes oreprefix, Materials material, int amount) { + return ItemUtils.getGregtechOreStack(oreprefix, material, amount); + } + + /** + * Generates a 16 Fluid Pipe + * @see {@code Example: Copper 16x Pipe (Materials.Copper, Materials.Copper.mName, "Copper", ID, 60, 1000, true)} + * @param aMaterial - Pipe Material + * @param name - Pipe Internal name + * @param displayName - Pipe Display Name + * @param aID - Pipe's Meta ID + * @param baseCapacity - Pipes Base Capacity + * @param heatCapacity - Pipe Max Temp + * @param gasProof - Is Gas Proof? + * @return A boolean which corresponds to whether or not the Pipe was registered to the Ore Dictionary. + */ + public static boolean generateHexadecuplePipe( + Materials aMaterial, + String name, + String displayName, + int aID, + int baseCapacity, + int heatCapacity, + boolean gasProof) { + if (Utils.getGregtechVersionAsInt() >= 50930) { + try { + Class aPipeEntity = GT_MetaPipeEntity_Fluid.class; + Constructor constructor = aPipeEntity.getConstructor(new Class[] { + int.class, + String.class, + String.class, + float.class, + Materials.class, + int.class, + int.class, + boolean.class, + int.class + }); + if (constructor != null) { + GT_MetaPipeEntity_Fluid aPipe; + aPipe = constructor.newInstance( + aID, + "GT_Pipe_" + name + "_Hexadecuple", + "Hexadecuple " + displayName + " Fluid Pipe", + 1.0F, + aMaterial, + baseCapacity, + heatCapacity, + gasProof, + 16); + return GT_OreDictUnificator.registerOre("pipeHexadecuple" + aMaterial, aPipe.getStackForm(1L)); + } + + } catch (NoSuchMethodException + | SecurityException + | InstantiationException + | IllegalAccessException + | IllegalArgumentException + | InvocationTargetException e) { + } + } + return false; + } + + public static ItemStack getCells(Materials aMaterial, int i) { + return ItemUtils.getOrePrefixStack(OrePrefixes.cell, aMaterial, i); + } + + public static ItemStack getDust(Materials aMaterial, int i) { + return ItemUtils.getOrePrefixStack(OrePrefixes.dust, aMaterial, i); + } + + public static ItemStack getDustSmall(Materials aMaterial, int i) { + return ItemUtils.getOrePrefixStack(OrePrefixes.dustSmall, aMaterial, i); + } + + public static ItemStack getDustTiny(Materials aMaterial, int i) { + return ItemUtils.getOrePrefixStack(OrePrefixes.dustTiny, aMaterial, i); + } - } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) { - } - } - return false; - } - - public static ItemStack getCells(Materials aMaterial, int i) { - return ItemUtils.getOrePrefixStack(OrePrefixes.cell, aMaterial, i); - } - public static ItemStack getDust(Materials aMaterial, int i) { - return ItemUtils.getOrePrefixStack(OrePrefixes.dust, aMaterial, i); - } - public static ItemStack getDustSmall(Materials aMaterial, int i) { - return ItemUtils.getOrePrefixStack(OrePrefixes.dustSmall, aMaterial, i); - } - public static ItemStack getDustTiny(Materials aMaterial, int i) { - return ItemUtils.getOrePrefixStack(OrePrefixes.dustTiny, aMaterial, i); - } - public static ItemStack getGems(Materials aMaterial, int i) { - return ItemUtils.getOrePrefixStack(OrePrefixes.gem, aMaterial, i); - } + public static ItemStack getGems(Materials aMaterial, int i) { + return ItemUtils.getOrePrefixStack(OrePrefixes.gem, aMaterial, i); + } } diff --git a/src/main/java/gtPlusPlus/api/interfaces/IChunkLoader.java b/src/main/java/gtPlusPlus/api/interfaces/IChunkLoader.java index c04e25f570..ad65c03429 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/IChunkLoader.java +++ b/src/main/java/gtPlusPlus/api/interfaces/IChunkLoader.java @@ -1,33 +1,31 @@ package gtPlusPlus.api.interfaces; import java.util.Set; - import net.minecraft.world.ChunkCoordIntPair; public interface IChunkLoader { - public long getTicksRemaining(); - - public void setTicksRemaining(long aTicks); - - public ChunkCoordIntPair getResidingChunk(); - - public void setResidingChunk(ChunkCoordIntPair aCurrentChunk); - - public boolean getChunkLoadingActive(); - - public void setChunkLoadingActive(boolean aActive); - - public boolean getDoesWorkChunkNeedReload(); - - public void setDoesWorkChunkNeedReload(boolean aActive); - - public boolean addChunkToLoadedList(ChunkCoordIntPair aActiveChunk); - - public boolean removeChunkFromLoadedList(ChunkCoordIntPair aActiveChunk); - - public Set getManagedChunks(); - - public int getChunkloaderTier(); - + public long getTicksRemaining(); + + public void setTicksRemaining(long aTicks); + + public ChunkCoordIntPair getResidingChunk(); + + public void setResidingChunk(ChunkCoordIntPair aCurrentChunk); + + public boolean getChunkLoadingActive(); + + public void setChunkLoadingActive(boolean aActive); + + public boolean getDoesWorkChunkNeedReload(); + + public void setDoesWorkChunkNeedReload(boolean aActive); + + public boolean addChunkToLoadedList(ChunkCoordIntPair aActiveChunk); + + public boolean removeChunkFromLoadedList(ChunkCoordIntPair aActiveChunk); + + public Set getManagedChunks(); + + public int getChunkloaderTier(); } diff --git a/src/main/java/gtPlusPlus/api/interfaces/IComparableRecipe.java b/src/main/java/gtPlusPlus/api/interfaces/IComparableRecipe.java index ddbf9f38bb..830b34a41d 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/IComparableRecipe.java +++ b/src/main/java/gtPlusPlus/api/interfaces/IComparableRecipe.java @@ -1,8 +1,5 @@ package gtPlusPlus.api.interfaces; import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GTPP_Recipe; -public interface IComparableRecipe extends Comparable{ - -} +public interface IComparableRecipe extends Comparable {} diff --git a/src/main/java/gtPlusPlus/api/interfaces/IEntityCatcher.java b/src/main/java/gtPlusPlus/api/interfaces/IEntityCatcher.java index 5ab90d47ce..9e3ea89606 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/IEntityCatcher.java +++ b/src/main/java/gtPlusPlus/api/interfaces/IEntityCatcher.java @@ -1,21 +1,19 @@ package gtPlusPlus.api.interfaces; +import gtPlusPlus.api.objects.minecraft.BlockPos; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import gtPlusPlus.api.objects.minecraft.BlockPos; - public interface IEntityCatcher { - public boolean hasEntity(ItemStack aStack); - - public Entity getStoredEntity(World aWorld, ItemStack aStack); - - public boolean setStoredEntity(World aWorld, ItemStack aStack, Entity aEntity); - - public Class getStoredEntityClass(ItemStack aStack); - - public boolean spawnStoredEntity(World aWorld, ItemStack aStack, BlockPos aPos); - + public boolean hasEntity(ItemStack aStack); + + public Entity getStoredEntity(World aWorld, ItemStack aStack); + + public boolean setStoredEntity(World aWorld, ItemStack aStack, Entity aEntity); + + public Class getStoredEntityClass(ItemStack aStack); + + public boolean spawnStoredEntity(World aWorld, ItemStack aStack, BlockPos aPos); } diff --git a/src/main/java/gtPlusPlus/api/interfaces/IGeneratorWorld.java b/src/main/java/gtPlusPlus/api/interfaces/IGeneratorWorld.java index 63f2adbba7..251eaa416c 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/IGeneratorWorld.java +++ b/src/main/java/gtPlusPlus/api/interfaces/IGeneratorWorld.java @@ -3,15 +3,14 @@ package gtPlusPlus.api.interfaces; import java.util.Random; import net.minecraft.world.World; -public abstract interface IGeneratorWorld -{ - public abstract boolean generate(World paramWorld, Random paramRandom, int paramInt1, int paramInt2); - - public abstract void initiate(); - - public abstract int getExtentX(); - - public abstract int getExtentZ(); - - public abstract int getRange(); +public abstract interface IGeneratorWorld { + public abstract boolean generate(World paramWorld, Random paramRandom, int paramInt1, int paramInt2); + + public abstract void initiate(); + + public abstract int getExtentX(); + + public abstract int getExtentZ(); + + public abstract int getRange(); } diff --git a/src/main/java/gtPlusPlus/api/interfaces/IGregtechPacketEntity.java b/src/main/java/gtPlusPlus/api/interfaces/IGregtechPacketEntity.java index fa59c58d9f..4a41e47a7b 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/IGregtechPacketEntity.java +++ b/src/main/java/gtPlusPlus/api/interfaces/IGregtechPacketEntity.java @@ -6,8 +6,7 @@ import java.io.IOException; public interface IGregtechPacketEntity { - public void writePacketData(DataOutputStream data) throws IOException; + public void writePacketData(DataOutputStream data) throws IOException; - public void readPacketData(DataInputStream data) throws IOException; - + public void readPacketData(DataInputStream data) throws IOException; } diff --git a/src/main/java/gtPlusPlus/api/interfaces/IGregtechPower.java b/src/main/java/gtPlusPlus/api/interfaces/IGregtechPower.java index 4bb29b3354..b4223fb558 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/IGregtechPower.java +++ b/src/main/java/gtPlusPlus/api/interfaces/IGregtechPower.java @@ -1,145 +1,143 @@ package gtPlusPlus.api.interfaces; +import gregtech.api.interfaces.IDescribable; +import gregtech.api.interfaces.tileentity.*; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import gregtech.api.interfaces.IDescribable; -import gregtech.api.interfaces.tileentity.*; +public abstract interface IGregtechPower + extends IGearEnergyTileEntity, ITurnable, IGregTechDeviceInformation, IDescribable, IBasicEnergyContainer { -public abstract interface IGregtechPower extends IGearEnergyTileEntity, ITurnable, IGregTechDeviceInformation, IDescribable, IBasicEnergyContainer { + @Override + public String[] getDescription(); - @Override - public String[] getDescription(); + @Override + default boolean isUniversalEnergyStored(long p0) { + return false; + } - @Override - default boolean isUniversalEnergyStored(long p0) { - return false; - } + @Override + public long getOutputAmperage(); - @Override - public long getOutputAmperage(); + @Override + public long getOutputVoltage(); - @Override - public long getOutputVoltage(); + @Override + public long getInputAmperage(); - @Override - public long getInputAmperage(); + @Override + public long getInputVoltage(); - @Override - public long getInputVoltage(); + @Override + public boolean decreaseStoredEnergyUnits(long p0, boolean p1); - @Override - public boolean decreaseStoredEnergyUnits(long p0, boolean p1); + @Override + public boolean increaseStoredEnergyUnits(long p0, boolean p1); - @Override - public boolean increaseStoredEnergyUnits(long p0, boolean p1); + @Override + public boolean drainEnergyUnits(byte p0, long p1, long p2); - @Override - public boolean drainEnergyUnits(byte p0, long p1, long p2); + @Override + public long getAverageElectricInput(); - @Override - public long getAverageElectricInput(); + @Override + public long getAverageElectricOutput(); - @Override - public long getAverageElectricOutput(); + @Override + public long getStoredEU(); - @Override - public long getStoredEU(); + @Override + public long getEUCapacity(); - @Override - public long getEUCapacity(); + @Override + public long getStoredSteam(); - @Override - public long getStoredSteam(); + @Override + public long getSteamCapacity(); - @Override - public long getSteamCapacity(); + @Override + public boolean increaseStoredSteam(long p0, boolean p1); - @Override - public boolean increaseStoredSteam(long p0, boolean p1); + @Override + public Block getBlockAtSide(byte p0); - @Override - public Block getBlockAtSide(byte p0); + @Override + public Block getBlockAtSideAndDistance(byte p0, int p1); - @Override - public Block getBlockAtSideAndDistance(byte p0, int p1); + @Override + public Block getBlockOffset(int p0, int p1, int p2); - @Override - public Block getBlockOffset(int p0, int p1, int p2); + @Override + public TileEntity getTileEntity(int p0, int p1, int p2); - - @Override - public TileEntity getTileEntity(int p0, int p1, int p2); + @Override + public TileEntity getTileEntityAtSide(byte p0); - @Override - public TileEntity getTileEntityAtSide(byte p0); + @Override + public TileEntity getTileEntityAtSideAndDistance(byte p0, int p1); - @Override - public TileEntity getTileEntityAtSideAndDistance(byte p0, int p1); + @Override + public TileEntity getTileEntityOffset(int p0, int p1, int p2); - @Override - public TileEntity getTileEntityOffset(int p0, int p1, int p2); + @Override + public World getWorld(); - @Override - public World getWorld(); + @Override + public int getXCoord(); - @Override - public int getXCoord(); + @Override + public short getYCoord(); - @Override - public short getYCoord(); + @Override + public int getZCoord(); - @Override - public int getZCoord(); + @Override + public boolean isClientSide(); - @Override - public boolean isClientSide(); + @Override + public boolean isDead(); - @Override - public boolean isDead(); + @Override + public boolean isInvalidTileEntity(); - @Override - public boolean isInvalidTileEntity(); + @Override + public boolean isServerSide(); - @Override - public boolean isServerSide(); + @Override + public void readFromNBT(NBTTagCompound p0); - @Override - public void readFromNBT(NBTTagCompound p0); + @Override + public void writeToNBT(NBTTagCompound p0); - @Override - public void writeToNBT(NBTTagCompound p0); - - @Override - public boolean acceptsRotationalEnergy(byte p0); + @Override + public boolean acceptsRotationalEnergy(byte p0); - @Override - public boolean injectRotationalEnergy(byte p0, long p1, long p2); + @Override + public boolean injectRotationalEnergy(byte p0, long p1, long p2); - @Override - public long injectEnergyUnits(byte p0, long p1, long p2); + @Override + public long injectEnergyUnits(byte p0, long p1, long p2); - @Override - public boolean inputEnergyFrom(byte p0); + @Override + public boolean inputEnergyFrom(byte p0); - @Override - public boolean outputsEnergyTo(byte p0); + @Override + public boolean outputsEnergyTo(byte p0); - @Override - public String[] getInfoData(); + @Override + public String[] getInfoData(); - @Override - default public boolean isGivingInformation() { - return true; - } + @Override + public default boolean isGivingInformation() { + return true; + } -/* boolean onPreTick(TilePoweredGT tilePoweredGT, long mTickTimer2); + /* boolean onPreTick(TilePoweredGT tilePoweredGT, long mTickTimer2); - boolean onTick(TilePoweredGT iGregTechTileEntity, long mTickTimer2); - - boolean onPostTick(TilePoweredGT iGregTechTileEntity, long mTickTimer2);*/ + boolean onTick(TilePoweredGT iGregTechTileEntity, long mTickTimer2); + boolean onPostTick(TilePoweredGT iGregTechTileEntity, long mTickTimer2);*/ } diff --git a/src/main/java/gtPlusPlus/api/interfaces/ILazyCoverable.java b/src/main/java/gtPlusPlus/api/interfaces/ILazyCoverable.java index 9e1a7431db..a643c86292 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/ILazyCoverable.java +++ b/src/main/java/gtPlusPlus/api/interfaces/ILazyCoverable.java @@ -5,140 +5,133 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; public interface ILazyCoverable extends ICoverable { - @Override - default byte getColorization() { - return 0; - } - - @Override - default byte setColorization(byte arg0) { - return 0; - } - - @Override - default byte getInputRedstoneSignal(byte arg0) { - return 0; - } - - @Override - default byte getStrongestRedstone() { - return 0; - } - - @Override - default boolean getRedstone() { - // TODO Auto-generated method stub - return false; - } - - @Override - default boolean getRedstone(byte arg0) { - return false; - } - - @Override - default boolean isUniversalEnergyStored(long arg0) { - return false; - } - - @Override - default long getUniversalEnergyStored() { - return 0; - } - - @Override - default long getUniversalEnergyCapacity() { - return 0; - } - - @Override - default long getStoredSteam() { - return 0; - } - - @Override - default long getSteamCapacity() { - return 0; - } - - @Override - default boolean increaseStoredSteam(long arg0, boolean arg2) { - return false; - } - - @Override - default byte getOutputRedstoneSignal(byte arg0) { - return 0; - } - - @Override - default void setOutputRedstoneSignal(byte arg0, byte arg1) { - - } - - @Override - default byte getStrongOutputRedstoneSignal(byte arg0) { - return 0; - } - - @Override - default void setStrongOutputRedstoneSignal(byte arg0, byte arg1) { - - } - - @Override - default byte getComparatorValue(byte arg0) { - return 0; - } - - @Override - default IGregTechTileEntity getIGregTechTileEntity(int arg0, int arg1, int arg2) { - return null; - } - - @Override - default IGregTechTileEntity getIGregTechTileEntityOffset(int arg0, int arg1, int arg2) { - return null; - } - - @Override - default IGregTechTileEntity getIGregTechTileEntityAtSide(byte arg0) { - return null; - } - - @Override - default IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte arg0, int arg1) { - return null; - } - - @Override - default byte getMetaID(int arg0, int arg1, int arg2) { - return 0; - } - - @Override - default byte getMetaIDOffset(int arg0, int arg1, int arg2) { - return 0; - } - - @Override - default byte getMetaIDAtSide(byte arg0) { - return 0; - } - - @Override - default byte getMetaIDAtSideAndDistance(byte arg0, int arg1) { - return 0; - } - - @Override - default boolean isDead() { - return false; - } - - @Override - default void setLightValue(byte arg0) { - - } - + @Override + default byte getColorization() { + return 0; + } + + @Override + default byte setColorization(byte arg0) { + return 0; + } + + @Override + default byte getInputRedstoneSignal(byte arg0) { + return 0; + } + + @Override + default byte getStrongestRedstone() { + return 0; + } + + @Override + default boolean getRedstone() { + // TODO Auto-generated method stub + return false; + } + + @Override + default boolean getRedstone(byte arg0) { + return false; + } + + @Override + default boolean isUniversalEnergyStored(long arg0) { + return false; + } + + @Override + default long getUniversalEnergyStored() { + return 0; + } + + @Override + default long getUniversalEnergyCapacity() { + return 0; + } + + @Override + default long getStoredSteam() { + return 0; + } + + @Override + default long getSteamCapacity() { + return 0; + } + + @Override + default boolean increaseStoredSteam(long arg0, boolean arg2) { + return false; + } + + @Override + default byte getOutputRedstoneSignal(byte arg0) { + return 0; + } + + @Override + default void setOutputRedstoneSignal(byte arg0, byte arg1) {} + + @Override + default byte getStrongOutputRedstoneSignal(byte arg0) { + return 0; + } + + @Override + default void setStrongOutputRedstoneSignal(byte arg0, byte arg1) {} + + @Override + default byte getComparatorValue(byte arg0) { + return 0; + } + + @Override + default IGregTechTileEntity getIGregTechTileEntity(int arg0, int arg1, int arg2) { + return null; + } + + @Override + default IGregTechTileEntity getIGregTechTileEntityOffset(int arg0, int arg1, int arg2) { + return null; + } + + @Override + default IGregTechTileEntity getIGregTechTileEntityAtSide(byte arg0) { + return null; + } + + @Override + default IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte arg0, int arg1) { + return null; + } + + @Override + default byte getMetaID(int arg0, int arg1, int arg2) { + return 0; + } + + @Override + default byte getMetaIDOffset(int arg0, int arg1, int arg2) { + return 0; + } + + @Override + default byte getMetaIDAtSide(byte arg0) { + return 0; + } + + @Override + default byte getMetaIDAtSideAndDistance(byte arg0, int arg1) { + return 0; + } + + @Override + default boolean isDead() { + return false; + } + + @Override + default void setLightValue(byte arg0) {} } diff --git a/src/main/java/gtPlusPlus/api/interfaces/IPlugin.java b/src/main/java/gtPlusPlus/api/interfaces/IPlugin.java index 67be182402..1f7991540a 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/IPlugin.java +++ b/src/main/java/gtPlusPlus/api/interfaces/IPlugin.java @@ -3,38 +3,40 @@ package gtPlusPlus.api.interfaces; import gtPlusPlus.api.objects.Logger; public interface IPlugin { - - /** - * @return A {@link String} object which returns the {@link IPlugin}'s name. - */ - public String getPluginName(); - - /** - * @return - * A {@link String} object which returns the {@link IPlugin}'s short name. - * This String should only contain 4 Characters. - */ - public String getPluginAbbreviation(); - - /** - * @param message - A {@link String} object which holds a message to be logged to console. - */ - default void log(String message) { - Logger.INFO("["+getPluginAbbreviation()+"] "+message); - } - - /** - * @param message - A {@link String} object which holds a warning/error message to be logged to console. - */ - default void logDebug(String message) { - Logger.WARNING("["+getPluginAbbreviation()+"] "+message); - } - - public boolean preInit(); - public boolean init(); - public boolean postInit(); - - public boolean serverStart(); - public boolean serverStop(); - + + /** + * @return A {@link String} object which returns the {@link IPlugin}'s name. + */ + public String getPluginName(); + + /** + * @return + * A {@link String} object which returns the {@link IPlugin}'s short name. + * This String should only contain 4 Characters. + */ + public String getPluginAbbreviation(); + + /** + * @param message - A {@link String} object which holds a message to be logged to console. + */ + default void log(String message) { + Logger.INFO("[" + getPluginAbbreviation() + "] " + message); + } + + /** + * @param message - A {@link String} object which holds a warning/error message to be logged to console. + */ + default void logDebug(String message) { + Logger.WARNING("[" + getPluginAbbreviation() + "] " + message); + } + + public boolean preInit(); + + public boolean init(); + + public boolean postInit(); + + public boolean serverStart(); + + public boolean serverStop(); } diff --git a/src/main/java/gtPlusPlus/api/interfaces/IRandomGenerator.java b/src/main/java/gtPlusPlus/api/interfaces/IRandomGenerator.java index 233fb93d4d..b61528e4b9 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/IRandomGenerator.java +++ b/src/main/java/gtPlusPlus/api/interfaces/IRandomGenerator.java @@ -51,5 +51,4 @@ public interface IRandomGenerator { * @return and int with the LSB being random */ public int next(int numBits); - } diff --git a/src/main/java/gtPlusPlus/api/interfaces/ITexturedBlock.java b/src/main/java/gtPlusPlus/api/interfaces/ITexturedBlock.java index 47e692bffb..815c399caf 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/ITexturedBlock.java +++ b/src/main/java/gtPlusPlus/api/interfaces/ITexturedBlock.java @@ -1,14 +1,12 @@ package gtPlusPlus.api.interfaces; -import net.minecraft.block.Block; - import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ITexturedTileEntity; +import net.minecraft.block.Block; -public interface ITexturedBlock extends ITexturedTileEntity{ +public interface ITexturedBlock extends ITexturedTileEntity { - ITexture[] getTexture(byte side); - - ITexture[] getTexture(Block block, byte side); + ITexture[] getTexture(byte side); + ITexture[] getTexture(Block block, byte side); } diff --git a/src/main/java/gtPlusPlus/api/interfaces/ITileTooltip.java b/src/main/java/gtPlusPlus/api/interfaces/ITileTooltip.java index 08866c2712..97c734659d 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/ITileTooltip.java +++ b/src/main/java/gtPlusPlus/api/interfaces/ITileTooltip.java @@ -2,6 +2,5 @@ package gtPlusPlus.api.interfaces; public interface ITileTooltip { - public abstract int getTooltipID(); - + public abstract int getTooltipID(); } diff --git a/src/main/java/gtPlusPlus/api/interfaces/IToolable.java b/src/main/java/gtPlusPlus/api/interfaces/IToolable.java index 24797825a9..d696585b76 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/IToolable.java +++ b/src/main/java/gtPlusPlus/api/interfaces/IToolable.java @@ -2,16 +2,21 @@ package gtPlusPlus.api.interfaces; public interface IToolable { - public boolean isScrewdriverable(); - public boolean onScrewdriverLMB(); - public boolean onScrewdriverRMB(); - - public boolean isWrenchable(); - public boolean onWrenchLMB(); - public boolean onWrenchRMB(); - - public boolean isMalletable(); - public boolean onMalletLMB(); - public boolean onMalletRMB(); - + public boolean isScrewdriverable(); + + public boolean onScrewdriverLMB(); + + public boolean onScrewdriverRMB(); + + public boolean isWrenchable(); + + public boolean onWrenchLMB(); + + public boolean onWrenchRMB(); + + public boolean isMalletable(); + + public boolean onMalletLMB(); + + public boolean onMalletRMB(); } diff --git a/src/main/java/gtPlusPlus/api/interfaces/RunnableWithInfo.java b/src/main/java/gtPlusPlus/api/interfaces/RunnableWithInfo.java index 4f4b9d7acd..c9415f6155 100644 --- a/src/main/java/gtPlusPlus/api/interfaces/RunnableWithInfo.java +++ b/src/main/java/gtPlusPlus/api/interfaces/RunnableWithInfo.java @@ -2,11 +2,9 @@ package gtPlusPlus.api.interfaces; public interface RunnableWithInfo extends Runnable { - public V getInfoData(); - - default public Class getInfoDataType() { - return getInfoData().getClass(); - } - - + public V getInfoData(); + + public default Class getInfoDataType() { + return getInfoData().getClass(); + } } diff --git a/src/main/java/gtPlusPlus/api/objects/GregtechException.java b/src/main/java/gtPlusPlus/api/objects/GregtechException.java index 916dbc4aaf..083a15f790 100644 --- a/src/main/java/gtPlusPlus/api/objects/GregtechException.java +++ b/src/main/java/gtPlusPlus/api/objects/GregtechException.java @@ -2,27 +2,24 @@ package gtPlusPlus.api.objects; public class GregtechException extends Throwable { - private static final long serialVersionUID = 3601884582161841486L; + private static final long serialVersionUID = 3601884582161841486L; - public GregtechException(String aError) { - this(aError, true); - } - - public GregtechException(String aError, boolean aIsVerbose) { - Logger.ERROR("Throwing GT++ Exception!"); - Logger.ERROR("[EXCEPTION] "+aError); - if (aIsVerbose) { - Logger.INFO("Throwing GT++ Exception!"); - Logger.INFO("[EXCEPTION] "+aError); - printStackTrace(); - } - } - - @Override - public void printStackTrace() { - super.printStackTrace(); - } - - + public GregtechException(String aError) { + this(aError, true); + } + public GregtechException(String aError, boolean aIsVerbose) { + Logger.ERROR("Throwing GT++ Exception!"); + Logger.ERROR("[EXCEPTION] " + aError); + if (aIsVerbose) { + Logger.INFO("Throwing GT++ Exception!"); + Logger.INFO("[EXCEPTION] " + aError); + printStackTrace(); + } + } + + @Override + public void printStackTrace() { + super.printStackTrace(); + } } diff --git a/src/main/java/gtPlusPlus/api/objects/Logger.java b/src/main/java/gtPlusPlus/api/objects/Logger.java index 5824c5260d..78f8ff101b 100644 --- a/src/main/java/gtPlusPlus/api/objects/Logger.java +++ b/src/main/java/gtPlusPlus/api/objects/Logger.java @@ -9,167 +9,151 @@ import org.apache.logging.log4j.LogManager; public class Logger { - public Logger(String string) { - - } - - // Logging Functions - public static final org.apache.logging.log4j.Logger modLogger = Logger.makeLogger(); - - // Generate GT++ Logger - public static org.apache.logging.log4j.Logger makeLogger() { - final org.apache.logging.log4j.Logger gtPlusPlusLogger = LogManager.getLogger("GT++"); - return gtPlusPlusLogger; - } - - private static final boolean enabled = !AsmConfig.disableAllLogging; - - public static final org.apache.logging.log4j.Logger getLogger() { - return modLogger; - } - - // Non-Dev Comments - public static void INFO(final String s) { - if (enabled) { - modLogger.info(s); - } - } - - // Non-Dev Comments - public static void MACHINE_INFO(String s, Object... args) { - if (enabled) { - boolean localPlayer = CORE_Preloader.DEV_ENVIRONMENT; - if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) { - final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2); - modLogger.info("Machine Info: " + s + " | " + name1, args); - } - } - } - - // Developer Comments - public static void WARNING(final String s) { - if (enabled) { - if (CORE_Preloader.DEBUG_MODE) { - modLogger.warn(s); - } - } - } - - // Errors - public static void ERROR(final String s) { - if (enabled) { - if (CORE_Preloader.DEBUG_MODE) { - modLogger.fatal(s); - } - } - } - - // Developer Logger - public static void SPECIFIC_WARNING(final String whatToLog, final String msg, final int line) { - if (enabled) { - // if (!CORE_Preloader.DEBUG_MODE){ - FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg); - // } - } - } - - // ASM Comments - public static void LOG_ASM(final String s) { - if (enabled) { - FMLRelaunchLog.info("[Special ASM Logging] ", s); - } - } - - - - - - - - - - - /** - * Special Loggers - */ - - /** - * Special Logger for Bee related content - */ - public static void BEES(final String s) { - modLogger.info("[Bees] "+s); - } - /** - * Special Logger for Debugging Bee related content - */ - public static void DEBUG_BEES(final String s) { - if (enabled) { - if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { - modLogger.info("[Debug][Bees] "+s); - } - } - } - - - - /** - * Special Logger for Materials related content - */ - public static void MATERIALS(final String s) { - if (enabled) { - if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { - modLogger.info("[Materials] "+s); - } - } - } - /** - * Special Logger for Debugging Materials related content - */ - public static void DEBUG_MATERIALS(final String s) { - if (enabled) { - if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { - modLogger.info("[Debug][Materials] "+s); - } - } - } - - /** - * Special Logger for Reflection related content - */ - public static void REFLECTION(final String s) { - if (enabled) { - if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { - modLogger.info("[Reflection] "+s); - } - } - } - - - /** - * Special Logger for Darkworld related content - */ - public static void WORLD(final String s) { - if (enabled) { - if (CORE_Preloader.DEV_ENVIRONMENT || CORE_Preloader.DEBUG_MODE) { - modLogger.info("[WorldGen] "+s); - } - } - } - - public static void RECIPE(String string) { - if (enabled) { - if (/*CORE_Preloader.DEV_ENVIRONMENT || */CORE_Preloader.DEBUG_MODE) { - modLogger.info("[Recipe] "+string); - } - } - } - - public static void SPACE(final String s) { - if (enabled) { - modLogger.info("[Space] "+s); - } - } - - - + public Logger(String string) {} + + // Logging Functions + public static final org.apache.logging.log4j.Logger modLogger = Logger.makeLogger(); + + // Generate GT++ Logger + public static org.apache.logging.log4j.Logger makeLogger() { + final org.apache.logging.log4j.Logger gtPlusPlusLogger = LogManager.getLogger("GT++"); + return gtPlusPlusLogger; + } + + private static final boolean enabled = !AsmConfig.disableAllLogging; + + public static final org.apache.logging.log4j.Logger getLogger() { + return modLogger; + } + + // Non-Dev Comments + public static void INFO(final String s) { + if (enabled) { + modLogger.info(s); + } + } + + // Non-Dev Comments + public static void MACHINE_INFO(String s, Object... args) { + if (enabled) { + boolean localPlayer = CORE_Preloader.DEV_ENVIRONMENT; + if (CORE.ConfigSwitches.MACHINE_INFO || local