diff options
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r-- | src/main/java/gregtech/api/enums/ItemList.java | 2 | ||||
-rw-r--r-- | src/main/java/gregtech/api/enums/Materials.java | 4 | ||||
-rw-r--r-- | src/main/java/gregtech/api/util/GT_Utility.java | 702 |
3 files changed, 388 insertions, 320 deletions
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index b735ba450e..4309a6022c 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -660,7 +660,7 @@ public enum ItemList implements IItemContainer { Teleporter, Cover_NeedsMaintainance, Casing_Turbine, - MobRep_LV, MobRep_MV, MobRep_HV, MobRep_EV, MobRep_IV, LargeGasTurbine, LargeHPSteamTurbine, LargePlasmaTurbine, Cover_PlayerDetector, Machine_Multi_HeatExchanger, AdvancedMiner2, Uraniumcell_1, Uraniumcell_2, Uraniumcell_4, Moxcell_1, Moxcell_2, Moxcell_4; + MobRep_LV, MobRep_MV, MobRep_HV, MobRep_EV, MobRep_IV, LargeGasTurbine, LargeHPSteamTurbine, LargePlasmaTurbine, Cover_PlayerDetector, Machine_Multi_HeatExchanger, OilDrill, AdvancedMiner2, Uraniumcell_1, Uraniumcell_2, Uraniumcell_4, Moxcell_1, Moxcell_2, Moxcell_4; public static final ItemList[] diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 643a8820eb..fe5b3f404e 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -512,6 +512,10 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer { Snow(728, TextureSet.SET_FINE, 1.0F, 0, 0, 1 | 16, 250, 250, 250, 0, "Snow", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeWhite, 0, Arrays.asList(new MaterialStack(Hydrogen, 2), new MaterialStack(Oxygen, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.GELUM, 1))), Sodalite(525, TextureSet.SET_LAPIS, 1.0F, 0, 1, 1 | 4 | 8, 20, 20, 255, 0, "Sodalite", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeBlue, 1, Arrays.asList(new MaterialStack(Aluminium, 3), new MaterialStack(Silicon, 3), new MaterialStack(Sodium, 4), new MaterialStack(Chlorine, 1))), SodiumPersulfate(718, TextureSet.SET_FLUID, 1.0F, 0, 2, 16, 255, 255, 255, 0, "Sodium Persulfate", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange, 1, Arrays.asList(new MaterialStack(Sodium, 1), new MaterialStack(Sulfur, 1), new MaterialStack(Oxygen, 4))), + OilHeavy ( 730, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 10, 10, 10, 0, "Heavy Oil" , 3, 32, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ), + OilMedium ( 731, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 10, 10, 10, 0, "Raw Oil" , 3, 24, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ), + OilLight ( 732, TextureSet.SET_FLUID , 1.0F, 0, 0, 16 , 10, 10, 10, 0, "Light Oil" , 3, 16, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack ), + NatruralGas ( 733, TextureSet.SET_FLUID , 1.0F, 0, 1, 16 , 255, 255, 255, 0, "Natural Gas" , 1, 15, -1, 0, false, false, 3, 1, 1, Dyes.dyeWhite ), SodiumSulfide(719, TextureSet.SET_FLUID, 1.0F, 0, 2, 16, 255, 255, 255, 0, "Sodium Sulfide", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange, 1, Arrays.asList(new MaterialStack(Sodium, 1), new MaterialStack(Sulfur, 1))), SolderingAlloy(314, TextureSet.SET_DULL, 1.0F, 0, 1, 1 | 2, 220, 220, 230, 0, "Soldering Alloy", 0, 0, 400, 400, false, false, 1, 1, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Tin, 9), new MaterialStack(Antimony, 1))), Spessartine(838, TextureSet.SET_DULL, 1.0F, 0, 2, 1 | 8, 255, 100, 100, 0, "Spessartine", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes.dyeRed, 1, Arrays.asList(new MaterialStack(Aluminium, 2), new MaterialStack(Manganese, 3), new MaterialStack(Silicon, 3), new MaterialStack(Oxygen, 12))), diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 2fd4b477db..df015a1e67 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -5,7 +5,9 @@ import cpw.mods.fml.common.FMLCommonHandler; import gregtech.api.GregTech_API; import gregtech.api.damagesources.GT_DamageSources; import gregtech.api.enchants.Enchantment_Radioactivity; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; import gregtech.api.enums.SubTag; import gregtech.api.events.BlockScanningEvent; import gregtech.api.interfaces.IDebugableBlock; @@ -17,6 +19,8 @@ import gregtech.api.net.GT_Packet_Sound; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.ItemData; import gregtech.api.threads.GT_Runnable_Sound; +import gregtech.common.GT_Proxy; + import ic2.api.recipe.IRecipeInput; import ic2.api.recipe.RecipeInputItemStack; import ic2.api.recipe.RecipeInputOreDict; @@ -50,6 +54,7 @@ import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.DimensionManager; @@ -82,7 +87,7 @@ public class GT_Utility { private static final Map<GT_ItemStack, FluidContainerData> sFilledContainerToData = new HashMap<GT_ItemStack, FluidContainerData>(); private static final Map<GT_ItemStack, Map<Fluid, FluidContainerData>> sEmptyContainerToFluidToData = new HashMap<GT_ItemStack, Map<Fluid, FluidContainerData>>(); public static volatile int VERSION = 508; - public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true; + public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true, RF_CHECK = false; public static Map<GT_PlayedSound, Integer> sPlayedSoundMap = new HashMap<GT_PlayedSound, Integer>(); private static int sBookCount = 0; @@ -333,6 +338,11 @@ public class GT_Utility { tClass.getCanonicalName(); BC_CHECK = true; } catch (Throwable e) {/**/} + try { + Class tClass = cofh.api.energy.IEnergyReceiver.class; + tClass.getCanonicalName(); + RF_CHECK = true; + } catch (Throwable e) {/**/} CHECK_ALL = false; } } @@ -802,26 +812,31 @@ public class GT_Utility { return copyMetaData(Items.feather.getDamage(aStack) + 1, aStack); return null; } + public static synchronized boolean removeIC2BottleRecipe(ItemStack aContainer, ItemStack aInput, Map<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> aRecipeList, ItemStack aOutput){ - if ((isStackInvalid(aInput) && isStackInvalid(aOutput) && isStackInvalid(aContainer)) || aRecipeList == null) return false; - boolean rReturn = false; - Iterator<Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput>> tIterator = aRecipeList.entrySet().iterator(); - aOutput = GT_OreDictUnificator.get(aOutput); - while (tIterator.hasNext()) { - Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> tEntry = tIterator.next(); - if (aInput == null || tEntry.getKey().matches(aContainer, aInput)) { - List<ItemStack> tList = tEntry.getValue().items; - if (tList != null) for (ItemStack tOutput : tList) - if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) { - tIterator.remove(); - rReturn = true; - break; - } - } + if ((isStackInvalid(aInput) && isStackInvalid(aOutput) && isStackInvalid(aContainer)) || aRecipeList == null) return false; + boolean rReturn = false; + Iterator<Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput>> tIterator = aRecipeList.entrySet().iterator(); + aOutput = GT_OreDictUnificator.get(aOutput); + while (tIterator.hasNext()) { + Map.Entry<ic2.api.recipe.ICannerBottleRecipeManager.Input, RecipeOutput> tEntry = tIterator.next(); + if (aInput == null || tEntry.getKey().matches(aContainer, aInput)) { + List<ItemStack> tList = tEntry.getValue().items; + if (tList != null) for (ItemStack tOutput : tList) + if (aOutput == null || areStacksEqual(GT_OreDictUnificator.get(tOutput), aOutput)) { + tIterator.remove(); + rReturn = true; + break; } - return rReturn; } + + + } + return rReturn; + } + + public static synchronized boolean removeSimpleIC2MachineRecipe(ItemStack aInput, Map<IRecipeInput, RecipeOutput> aRecipeList, ItemStack aOutput) { if ((isStackInvalid(aInput) && isStackInvalid(aOutput)) || aRecipeList == null) return false; boolean rReturn = false; @@ -1496,6 +1511,51 @@ public class GT_Utility { } return false; } + public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ) { + + + + + Random tRandom = new Random((aWorld.getSeed() + (aX / 96) + (7 * (aZ / 96)))); + int oil = tRandom.nextInt(3); + double amount = tRandom.nextInt(50) + tRandom.nextDouble(); + oil = tRandom.nextInt(4); +// System.out.println("Oil: "+(aX/96)+" "+(aZ/96)+" "+oil+" "+amount); +// amount = 40; + Fluid tFluid = null; + switch (oil) { + case 0: + tFluid = Materials.NatruralGas.mGas; + break; + case 1: + tFluid = Materials.OilLight.mFluid; + break; + case 2: + tFluid = Materials.OilMedium.mFluid; + break; + case 3: + tFluid = Materials.OilHeavy.mFluid; + break; + default: + tFluid = Materials.Oil.mFluid; + } + int tAmount = (int) (Math.pow(amount, 5) / 100); + ChunkPosition tPos = new ChunkPosition(aX/16, 1, aZ/16); + if(GT_Proxy.chunkData.containsKey(tPos)){ + int[] tInts = GT_Proxy.chunkData.get(tPos); + if(tInts.length>0){ + if(tInts[0]>=0){tAmount = tInts[0];} + } + + GT_Proxy.chunkData.remove(tPos); + } + + tAmount = tAmount - 5; + GT_Proxy.chunkData.put(tPos, new int[]{tAmount}); + + + return new FluidStack(tFluid, tAmount); + } public static int getCoordinateScan(ArrayList<String> aList, EntityPlayer aPlayer, World aWorld, int aScanLevel, int aX, int aY, int aZ, int aSide, float aClickX, float aClickY, float aClickZ) { if (aList == null) return 0; @@ -1519,187 +1579,192 @@ public class GT_Utility { } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); } - if (tTileEntity != null) { - try { - if (tTileEntity instanceof IFluidHandler) { - rEUAmount += 500; - FluidTankInfo[] tTanks = ((IFluidHandler) tTileEntity).getTankInfo(ForgeDirection.getOrientation(aSide)); - if (tTanks != null) for (byte i = 0; i < tTanks.length; i++) { - tList.add("Tank " + i + ": " + GT_Utility.formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) + " / " + GT_Utility.formatNumbers(tTanks[i].capacity) + " " + getFluidName(tTanks[i].fluid, true)); - } - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); - } - try { - if (tTileEntity instanceof ic2.api.reactor.IReactorChamber) { - rEUAmount += 500; - tTileEntity = (TileEntity) (((ic2.api.reactor.IReactorChamber) tTileEntity).getReactor()); + + if (tTileEntity != null) { + try { + if (tTileEntity instanceof IFluidHandler) { + rEUAmount += 500; + FluidTankInfo[] tTanks = ((IFluidHandler) tTileEntity).getTankInfo(ForgeDirection.getOrientation(aSide)); + if (tTanks != null) for (byte i = 0; i < tTanks.length; i++) { + tList.add("Tank " + i + ": " + GT_Utility.formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) + " / " + GT_Utility.formatNumbers(tTanks[i].capacity) + " " + getFluidName(tTanks[i].fluid, true)); } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); } - try { - if (tTileEntity instanceof ic2.api.reactor.IReactor) { - rEUAmount += 500; - tList.add("Heat: " + ((ic2.api.reactor.IReactor) tTileEntity).getHeat() + "/" + ((ic2.api.reactor.IReactor) tTileEntity).getMaxHeat() - + " HEM: " + ((ic2.api.reactor.IReactor) tTileEntity).getHeatEffectModifier() + " Base EU Output: "/* + ((ic2.api.reactor.IReactor)tTileEntity).getOutput()*/); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof ic2.api.reactor.IReactorChamber) { + rEUAmount += 500; + tTileEntity = (TileEntity) (((ic2.api.reactor.IReactorChamber) tTileEntity).getReactor()); } - try { - if (tTileEntity instanceof ic2.api.tile.IWrenchable) { - rEUAmount += 100; - tList.add("Facing: " + ((ic2.api.tile.IWrenchable) tTileEntity).getFacing() + " / Chance: " + (((ic2.api.tile.IWrenchable) tTileEntity).getWrenchDropRate() * 100) + "%"); - tList.add(((ic2.api.tile.IWrenchable) tTileEntity).wrenchCanRemove(aPlayer) ? "You can remove this with a Wrench" : "You can NOT remove this with a Wrench"); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof ic2.api.reactor.IReactor) { + rEUAmount += 500; + tList.add("Heat: " + ((ic2.api.reactor.IReactor) tTileEntity).getHeat() + "/" + ((ic2.api.reactor.IReactor) tTileEntity).getMaxHeat() + + " HEM: " + ((ic2.api.reactor.IReactor) tTileEntity).getHeatEffectModifier() + " Base EU Output: "/* + ((ic2.api.reactor.IReactor)tTileEntity).getOutput()*/); } - try { - if (tTileEntity instanceof ic2.api.energy.tile.IEnergyTile) { - rEUAmount += 200; - //aList.add(((ic2.api.energy.tile.IEnergyTile)tTileEntity).isAddedToEnergyNet()?"Added to E-net":"Not added to E-net! Bug?"); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof ic2.api.tile.IWrenchable) { + rEUAmount += 100; + tList.add("Facing: " + ((ic2.api.tile.IWrenchable) tTileEntity).getFacing() + " / Chance: " + (((ic2.api.tile.IWrenchable) tTileEntity).getWrenchDropRate() * 100) + "%"); + tList.add(((ic2.api.tile.IWrenchable) tTileEntity).wrenchCanRemove(aPlayer) ? "You can remove this with a Wrench" : "You can NOT remove this with a Wrench"); } - try { - if (tTileEntity instanceof ic2.api.energy.tile.IEnergySink) { - rEUAmount += 400; - //aList.add("Demanded Energy: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).demandsEnergy()); - //tList.add("Max Safe Input: " + getTier(((ic2.api.energy.tile.IEnergySink)tTileEntity).getSinkTier())); - //tList.add("Max Safe Input: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).getMaxSafeInput()); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof ic2.api.energy.tile.IEnergyTile) { + rEUAmount += 200; + //aList.add(((ic2.api.energy.tile.IEnergyTile)tTileEntity).isAddedToEnergyNet()?"Added to E-net":"Not added to E-net! Bug?"); } - try { - if (tTileEntity instanceof ic2.api.energy.tile.IEnergySource) { - rEUAmount += 400; - //aList.add("Max Energy Output: " + ((ic2.api.energy.tile.IEnergySource)tTileEntity).getMaxEnergyOutput()); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof ic2.api.energy.tile.IEnergySink) { + rEUAmount += 400; + //aList.add("Demanded Energy: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).demandsEnergy()); + //tList.add("Max Safe Input: " + getTier(((ic2.api.energy.tile.IEnergySink)tTileEntity).getSinkTier())); + //tList.add("Max Safe Input: " + ((ic2.api.energy.tile.IEnergySink)tTileEntity).getMaxSafeInput()); } - try { - if (tTileEntity instanceof ic2.api.energy.tile.IEnergyConductor) { - rEUAmount += 200; - tList.add("Conduction Loss: " + ((ic2.api.energy.tile.IEnergyConductor) tTileEntity).getConductionLoss()); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof ic2.api.energy.tile.IEnergySource) { + rEUAmount += 400; + //aList.add("Max Energy Output: " + ((ic2.api.energy.tile.IEnergySource)tTileEntity).getMaxEnergyOutput()); } - try { - if (tTileEntity instanceof ic2.api.tile.IEnergyStorage) { - rEUAmount += 200; - tList.add("Contained Energy: " + ((ic2.api.tile.IEnergyStorage) tTileEntity).getStored() + " of " + ((ic2.api.tile.IEnergyStorage) tTileEntity).getCapacity()); - //aList.add(((ic2.api.tile.IEnergyStorage)tTileEntity).isTeleporterCompatible(ic2.api.Direction.YP)?"Teleporter Compatible":"Not Teleporter Compatible"); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof ic2.api.energy.tile.IEnergyConductor) { + rEUAmount += 200; + tList.add("Conduction Loss: " + ((ic2.api.energy.tile.IEnergyConductor) tTileEntity).getConductionLoss()); } - try { - if (tTileEntity instanceof IUpgradableMachine) { - rEUAmount += 500; - if (((IUpgradableMachine) tTileEntity).hasMufflerUpgrade()) tList.add("Has Muffler Upgrade"); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof ic2.api.tile.IEnergyStorage) { + rEUAmount += 200; + tList.add("Contained Energy: " + ((ic2.api.tile.IEnergyStorage) tTileEntity).getStored() + " of " + ((ic2.api.tile.IEnergyStorage) tTileEntity).getCapacity()); + //aList.add(((ic2.api.tile.IEnergyStorage)tTileEntity).isTeleporterCompatible(ic2.api.Direction.YP)?"Teleporter Compatible":"Not Teleporter Compatible"); } - try { - if (tTileEntity instanceof IMachineProgress) { - rEUAmount += 400; - int tValue = 0; - if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress())) - tList.add("Progress: " + GT_Utility.formatNumbers(tValue) + " / " + GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress())); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof IUpgradableMachine) { + rEUAmount += 500; + if (((IUpgradableMachine) tTileEntity).hasMufflerUpgrade()) tList.add("Has Muffler Upgrade"); } - try { - if (tTileEntity instanceof ICoverable) { - rEUAmount += 300; - String tString = ((ICoverable) tTileEntity).getCoverBehaviorAtSide((byte) aSide).getDescription((byte) aSide, ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide), ((ICoverable) tTileEntity).getCoverDataAtSide((byte) aSide), (ICoverable) tTileEntity); - if (tString != null && !tString.equals(E)) tList.add(tString); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof IMachineProgress) { + rEUAmount += 400; + int tValue = 0; + if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress())) + tList.add("Progress: " + GT_Utility.formatNumbers(tValue) + " / " + GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress())); } - try { - if (tTileEntity instanceof IBasicEnergyContainer && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) { - tList.add("Max IN: " + ((IBasicEnergyContainer) tTileEntity).getInputVoltage() + " EU"); - tList.add("Max OUT: " + ((IBasicEnergyContainer) tTileEntity).getOutputVoltage() + " EU at " + ((IBasicEnergyContainer) tTileEntity).getOutputAmperage() + " Amperes"); - tList.add("Energy: " + GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) + " / " + GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) + "EU"); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof ICoverable) { + rEUAmount += 300; + String tString = ((ICoverable) tTileEntity).getCoverBehaviorAtSide((byte) aSide).getDescription((byte) aSide, ((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide), ((ICoverable) tTileEntity).getCoverDataAtSide((byte) aSide), (ICoverable) tTileEntity); + if (tString != null && !tString.equals(E)) tList.add(tString); } - try { - if (tTileEntity instanceof IGregTechTileEntity) { - tList.add("Owned by: " + ((IGregTechTileEntity) tTileEntity).getOwnerName()); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof IBasicEnergyContainer && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) { + tList.add("Max IN: " + ((IBasicEnergyContainer) tTileEntity).getInputVoltage() + " EU"); + tList.add("Max OUT: " + ((IBasicEnergyContainer) tTileEntity).getOutputVoltage() + " EU at " + ((IBasicEnergyContainer) tTileEntity).getOutputAmperage() + " Amperes"); + tList.add("Energy: " + GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) + " / " + GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) + "EU"); } - try { - if (tTileEntity instanceof IGregTechDeviceInformation && ((IGregTechDeviceInformation) tTileEntity).isGivingInformation()) { - tList.addAll(Arrays.asList(((IGregTechDeviceInformation) tTileEntity).getInfoData())); - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof IGregTechTileEntity) { + tList.add("Owned by: " + ((IGregTechTileEntity) tTileEntity).getOwnerName()); } - try { - if (tTileEntity instanceof ic2.api.crops.ICropTile) { - if (((ic2.api.crops.ICropTile) tTileEntity).getScanLevel() < 4) { - rEUAmount += 10000; - ((ic2.api.crops.ICropTile) tTileEntity).setScanLevel((byte) 4); - } - if (((ic2.api.crops.ICropTile) tTileEntity).getID() >= 0 && ((ic2.api.crops.ICropTile) tTileEntity).getID() < ic2.api.crops.Crops.instance.getCropList().length && ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()] != null) { - rEUAmount += 1000; - tList.add("Type -- Crop-Name: " + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].name() - + " Growth: " + ((ic2.api.crops.ICropTile) tTileEntity).getGrowth() - + " Gain: " + ((ic2.api.crops.ICropTile) tTileEntity).getGain() - + " Resistance: " + ((ic2.api.crops.ICropTile) tTileEntity).getResistance() - ); - tList.add("Plant -- Fertilizer: " + ((ic2.api.crops.ICropTile) tTileEntity).getNutrientStorage() - + " Water: " + ((ic2.api.crops.ICropTile) tTileEntity).getHydrationStorage() - + " Weed-Ex: " + ((ic2.api.crops.ICropTile) tTileEntity).getWeedExStorage() - + " Scan-Level: " + ((ic2.api.crops.ICropTile) tTileEntity).getScanLevel() - ); - tList.add("Environment -- Nutrients: " + ((ic2.api.crops.ICropTile) tTileEntity).getNutrients() - + " Humidity: " + ((ic2.api.crops.ICropTile) tTileEntity).getHumidity() - + " Air-Quality: " + ((ic2.api.crops.ICropTile) tTileEntity).getAirQuality() - ); - String tString = E; - for (String tAttribute : ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].attributes()) { - tString += ", " + tAttribute; - } - tList.add("Attributes:" + tString.replaceFirst(",", E)); - tList.add("Discovered by: " + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].discoveredBy()); - } - } - } catch (Throwable e) { - if (D1) e.printStackTrace(GT_Log.err); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + try { + if (tTileEntity instanceof IGregTechDeviceInformation && ((IGregTechDeviceInformation) tTileEntity).isGivingInformation()) { + tList.addAll(Arrays.asList(((IGregTechDeviceInformation) tTileEntity).getInfoData())); } + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); } try { - if (tBlock instanceof IDebugableBlock) { - rEUAmount += 500; - ArrayList<String> temp = ((IDebugableBlock) tBlock).getDebugInfo(aPlayer, aX, aY, aZ, 3); - if (temp != null) tList.addAll(temp); + if (tTileEntity instanceof ic2.api.crops.ICropTile) { + if (((ic2.api.crops.ICropTile) tTileEntity).getScanLevel() < 4) { + rEUAmount += 10000; + ((ic2.api.crops.ICropTile) tTileEntity).setScanLevel((byte) 4); + } + if (((ic2.api.crops.ICropTile) tTileEntity).getID() >= 0 && ((ic2.api.crops.ICropTile) tTileEntity).getID() < ic2.api.crops.Crops.instance.getCropList().length && ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()] != null) { + rEUAmount += 1000; + tList.add("Type -- Crop-Name: " + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].name() + + " Growth: " + ((ic2.api.crops.ICropTile) tTileEntity).getGrowth() + + " Gain: " + ((ic2.api.crops.ICropTile) tTileEntity).getGain() + + " Resistance: " + ((ic2.api.crops.ICropTile) tTileEntity).getResistance() + ); + tList.add("Plant -- Fertilizer: " + ((ic2.api.crops.ICropTile) tTileEntity).getNutrientStorage() + + " Water: " + ((ic2.api.crops.ICropTile) tTileEntity).getHydrationStorage() + + " Weed-Ex: " + ((ic2.api.crops.ICropTile) tTileEntity).getWeedExStorage() + + " Scan-Level: " + ((ic2.api.crops.ICropTile) tTileEntity).getScanLevel() + ); + tList.add("Environment -- Nutrients: " + ((ic2.api.crops.ICropTile) tTileEntity).getNutrients() + + " Humidity: " + ((ic2.api.crops.ICropTile) tTileEntity).getHumidity() + + " Air-Quality: " + ((ic2.api.crops.ICropTile) tTileEntity).getAirQuality() + ); + String tString = E; + for (String tAttribute : ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].attributes()) { + tString += ", " + tAttribute; + } + tList.add("Attributes:" + tString.replaceFirst(",", E)); + tList.add("Discovered by: " + ic2.api.crops.Crops.instance.getCropList()[((ic2.api.crops.ICropTile) tTileEntity).getID()].discoveredBy()); + } } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); } - - BlockScanningEvent tEvent = new BlockScanningEvent(aWorld, aPlayer, aX, aY, aZ, (byte) aSide, aScanLevel, tBlock, tTileEntity, tList, aClickX, aClickY, aClickZ); - tEvent.mEUCost = rEUAmount; - MinecraftForge.EVENT_BUS.post(tEvent); - if (!tEvent.isCanceled()) aList.addAll(tList); - return tEvent.mEUCost; } + if (aPlayer.capabilities.isCreativeMode&>_Values.D1) { + FluidStack tFluid = getUndergroundOil(aWorld, aX, aZ); + tList.add("Oil in Chunk: " + tFluid.amount + " " + tFluid.getLocalizedName()); + } + try { + if (tBlock instanceof IDebugableBlock) { + rEUAmount += 500; + ArrayList<String> temp = ((IDebugableBlock) tBlock).getDebugInfo(aPlayer, aX, aY, aZ, 3); + if (temp != null) tList.addAll(temp); + } + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + + BlockScanningEvent tEvent = new BlockScanningEvent(aWorld, aPlayer, aX, aY, aZ, (byte) aSide, aScanLevel, tBlock, tTileEntity, tList, aClickX, aClickY, aClickZ); + tEvent.mEUCost = rEUAmount; + MinecraftForge.EVENT_BUS.post(tEvent); + if (!tEvent.isCanceled()) aList.addAll(tList); + return tEvent.mEUCost; +} /** * @return an Array containing the X and the Y Coordinate of the clicked Point, with the top left Corner as Origin, like on the Texture Sheet. return values should always be between [0.0F and 0.99F]. @@ -1786,187 +1851,186 @@ public class GT_Utility { return formatter.format(aNumber); } - public static class ItemNBT { - public static void setNBT(ItemStack aStack, NBTTagCompound aNBT) { - if (aNBT == null) { - aStack.setTagCompound(null); - return; - } - ArrayList<String> tTagsToRemove = new ArrayList<String>(); - for (Object tKey : aNBT.func_150296_c()) { - NBTBase tValue = aNBT.getTag((String) tKey); - if (tValue == null || (tValue instanceof NBTPrimitive && ((NBTPrimitive) tValue).func_150291_c() == 0) || (tValue instanceof NBTTagString && isStringInvalid(((NBTTagString) tValue).func_150285_a_()))) - tTagsToRemove.add((String) tKey); - } - for (Object tKey : tTagsToRemove) aNBT.removeTag((String) tKey); - aStack.setTagCompound(aNBT.hasNoTags() ? null : aNBT); - } - - public static NBTTagCompound getNBT(ItemStack aStack) { - NBTTagCompound rNBT = aStack.getTagCompound(); - return rNBT == null ? new NBTTagCompound() : rNBT; +public static class ItemNBT { + public static void setNBT(ItemStack aStack, NBTTagCompound aNBT) { + if (aNBT == null) { + aStack.setTagCompound(null); + return; } - - public static void setPunchCardData(ItemStack aStack, String aPunchCardData) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setString("GT.PunchCardData", aPunchCardData); - setNBT(aStack, tNBT); + ArrayList<String> tTagsToRemove = new ArrayList<String>(); + for (Object tKey : aNBT.func_150296_c()) { + NBTBase tValue = aNBT.getTag((String) tKey); + if (tValue == null || (tValue instanceof NBTPrimitive && ((NBTPrimitive) tValue).func_150291_c() == 0) || (tValue instanceof NBTTagString && isStringInvalid(((NBTTagString) tValue).func_150285_a_()))) + tTagsToRemove.add((String) tKey); } + for (Object tKey : tTagsToRemove) aNBT.removeTag((String) tKey); + aStack.setTagCompound(aNBT.hasNoTags() ? null : aNBT); + } - public static String getPunchCardData(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getString("GT.PunchCardData"); - } + public static NBTTagCompound getNBT(ItemStack aStack) { + NBTTagCompound rNBT = aStack.getTagCompound(); + return rNBT == null ? new NBTTagCompound() : rNBT; + } - public static void setLighterFuel(ItemStack aStack, long aFuel) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setLong("GT.LighterFuel", aFuel); - setNBT(aStack, tNBT); - } + public static void setPunchCardData(ItemStack aStack, String aPunchCardData) { + NBTTagCompound tNBT = getNBT(aStack); + tNBT.setString("GT.PunchCardData", aPunchCardData); + setNBT(aStack, tNBT); + } - public static long getLighterFuel(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getLong("GT.LighterFuel"); - } + public static String getPunchCardData(ItemStack aStack) { + NBTTagCompound tNBT = getNBT(aStack); + return tNBT.getString("GT.PunchCardData"); + } - public static void setMapID(ItemStack aStack, short aMapID) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setShort("map_id", aMapID); - setNBT(aStack, tNBT); - } + public static void setLighterFuel(ItemStack aStack, long aFuel) { + NBTTagCompound tNBT = getNBT(aStack); + tNBT.setLong("GT.LighterFuel", aFuel); + setNBT(aStack, tNBT); + } - public static short getMapID(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - if (!tNBT.hasKey("map_id")) return -1; - return tNBT.getShort("map_id"); - } + public static long getLighterFuel(ItemStack aStack) { + NBTTagCompound tNBT = getNBT(aStack); + return tNBT.getLong("GT.LighterFuel"); + } - public static void setBookTitle(ItemStack aStack, String aTitle) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setString("title", aTitle); - setNBT(aStack, tNBT); - } + public static void setMapID(ItemStack aStack, short aMapID) { + NBTTagCompound tNBT = getNBT(aStack); + tNBT.setShort("map_id", aMapID); + setNBT(aStack, tNBT); + } - public static String getBookTitle(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getString("title"); - } + public static short getMapID(ItemStack aStack) { + NBTTagCompound tNBT = getNBT(aStack); + if (!tNBT.hasKey("map_id")) return -1; + return tNBT.getShort("map_id"); + } - public static void setBookAuthor(ItemStack aStack, String aAuthor) { - NBTTagCompound tNBT = getNBT(aStack); - tNBT.setString("author", aAuthor); - setNBT(aStack, tNBT); - } + public static void setBookTitle(ItemStack aStack, String aTitle) { + NBTTagCompound tNBT = getNBT(aStack); + tNBT.setString("title", aTitle); + setNBT(aStack, tNBT); + } - public static String getBookAuthor(ItemStack aStack) { - NBTTagCompound tNBT = getNBT(aStack); - return tNBT.getString("author"); - } + public static String getBookTitle(ItemStack aStack) { + NBTTagCompound tNBT = getNBT(aStack); + return tNBT.getString("title"); + } - public static void addEnchantment(ItemStack aStack, Enchantment aEnchantment, int aLevel) { - NBTTagCompound tNBT = getNBT(aStack), tEnchantmentTag; - if (!tNBT.hasKey("ench", 9)) tNBT.setTag("ench", new NBTTagList()); - NBTTagList tList = tNBT.getTagList("ench", 10); + public static void setBookAuthor(ItemStack aStack, String aAuthor) { + NBTTagCompound tNBT = getNBT(aStack); + tNBT.setString("author", aAuthor); + setNBT(aStack, tNBT); + } - boolean temp = true; + public static String getBookAuthor(ItemStack aStack) { + NBTTagCompound tNBT = getNBT(aStack); + return tNBT.getString("author"); + } + public static void addEnchantment(ItemStack aStack, Enchantment aEnchantment, int aLevel) { + NBTTagCompound tNBT = getNBT(aStack), tEnchantmentTag; + if (!tNBT.hasKey("ench", 9)) tNBT.setTag("ench", new NBTTagList()); + NBTTagList tList = tNBT.getTagList("ench", 10); - for (int i = 0; i < tList.tagCount(); i++) { - tEnchantmentTag = tList.getCompoundTagAt(i); - if (tEnchantmentTag.getShort("id") == aEnchantment.effectId) { - tEnchantmentTag.setShort("id", (short) aEnchantment.effectId); - tEnchantmentTag.setShort("lvl", (byte) aLevel); - temp = false; - break; - } - } + boolean temp = true; - if (temp) { - tEnchantmentTag = new NBTTagCompound(); + for (int i = 0; i < tList.tagCount(); i++) { + tEnchantmentTag = tList.getCompoundTagAt(i); + if (tEnchantmentTag.getShort("id") == aEnchantment.effectId) { tEnchantmentTag.setShort("id", (short) aEnchantment.effectId); tEnchantmentTag.setShort("lvl", (byte) aLevel); - tList.appendTag(tEnchantmentTag); + temp = false; + break; } - aStack.setTagCompound(tNBT); } + + if (temp) { + tEnchantmentTag = new NBTTagCompound(); + tEnchantmentTag.setShort("id", (short) aEnchantment.effectId); + tEnchantmentTag.setShort("lvl", (byte) aLevel); + tList.appendTag(tEnchantmentTag); + } + aStack.setTagCompound(tNBT); } +} - /** - * THIS IS BULLSHIT!!! WHY DO I HAVE TO DO THIS SHIT JUST TO HAVE ENCHANTS PROPERLY!?! - */ - public static class GT_EnchantmentHelper { - private static final BullshitIteratorA mBullshitIteratorA = new BullshitIteratorA(); - private static final BullshitIteratorB mBullshitIteratorB = new BullshitIteratorB(); - - private static void applyBullshit(IBullshit aBullshitModifier, ItemStack aStack) { - if (aStack != null) { - NBTTagList nbttaglist = aStack.getEnchantmentTagList(); - if (nbttaglist != null) { - for (int i = 0; i < nbttaglist.tagCount(); ++i) { - try { - short short1 = nbttaglist.getCompoundTagAt(i).getShort("id"); - short short2 = nbttaglist.getCompoundTagAt(i).getShort("lvl"); - if (Enchantment.enchantmentsList[short1] != null) - aBullshitModifier.calculateModifier(Enchantment.enchantmentsList[short1], short2); - } catch (Throwable e) { - // - } +/** + * THIS IS BULLSHIT!!! WHY DO I HAVE TO DO THIS SHIT JUST TO HAVE ENCHANTS PROPERLY!?! + */ +public static class GT_EnchantmentHelper { + private static final BullshitIteratorA mBullshitIteratorA = new BullshitIteratorA(); + private static final BullshitIteratorB mBullshitIteratorB = new BullshitIteratorB(); + + private static void applyBullshit(IBullshit aBullshitModifier, ItemStack aStack) { + if (aStack != null) { + NBTTagList nbttaglist = aStack.getEnchantmentTagList(); + if (nbttaglist != null) { + for (int i = 0; i < nbttaglist.tagCount(); ++i) { + try { + short short1 = nbttaglist.getCompoundTagAt(i).getShort("id"); + short short2 = nbttaglist.getCompoundTagAt(i).getShort("lvl"); + if (Enchantment.enchantmentsList[short1] != null) + aBullshitModifier.calculateModifier(Enchantment.enchantmentsList[short1], short2); + } catch (Throwable e) { + // } } } } + } - private static void applyArrayOfBullshit(IBullshit aBullshitModifier, ItemStack[] aStacks) { - ItemStack[] aitemstack1 = aStacks; - int i = aStacks.length; - for (int j = 0; j < i; ++j) { - ItemStack itemstack = aitemstack1[j]; - applyBullshit(aBullshitModifier, itemstack); - } + private static void applyArrayOfBullshit(IBullshit aBullshitModifier, ItemStack[] aStacks) { + ItemStack[] aitemstack1 = aStacks; + int i = aStacks.length; + for (int j = 0; j < i; ++j) { + ItemStack itemstack = aitemstack1[j]; + applyBullshit(aBullshitModifier, itemstack); } + } - public static void applyBullshitA(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) { - mBullshitIteratorA.mPlayer = aPlayer; - mBullshitIteratorA.mEntity = aEntity; - if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorA, aPlayer.getLastActiveItems()); - if (aStack != null) applyBullshit(mBullshitIteratorA, aStack); - } + public static void applyBullshitA(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) { + mBullshitIteratorA.mPlayer = aPlayer; + mBullshitIteratorA.mEntity = aEntity; + if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorA, aPlayer.getLastActiveItems()); + if (aStack != null) applyBullshit(mBullshitIteratorA, aStack); + } - public static void applyBullshitB(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) { - mBullshitIteratorB.mPlayer = aPlayer; - mBullshitIteratorB.mEntity = aEntity; - if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorB, aPlayer.getLastActiveItems()); - if (aStack != null) applyBullshit(mBullshitIteratorB, aStack); - } + public static void applyBullshitB(EntityLivingBase aPlayer, Entity aEntity, ItemStack aStack) { + mBullshitIteratorB.mPlayer = aPlayer; + mBullshitIteratorB.mEntity = aEntity; + if (aPlayer != null) applyArrayOfBullshit(mBullshitIteratorB, aPlayer.getLastActiveItems()); + if (aStack != null) applyBullshit(mBullshitIteratorB, aStack); + } - interface IBullshit { - void calculateModifier(Enchantment aEnchantment, int aLevel); - } + interface IBullshit { + void calculateModifier(Enchantment aEnchantment, int aLevel); + } - static final class BullshitIteratorA implements IBullshit { - public EntityLivingBase mPlayer; - public Entity mEntity; + static final class BullshitIteratorA implements IBullshit { + public EntityLivingBase mPlayer; + public Entity mEntity; - BullshitIteratorA() { - } + BullshitIteratorA() { + } - @Override - public void calculateModifier(Enchantment aEnchantment, int aLevel) { - aEnchantment.func_151367_b(mPlayer, mEntity, aLevel); - } + @Override + public void calculateModifier(Enchantment aEnchantment, int aLevel) { + aEnchantment.func_151367_b(mPlayer, mEntity, aLevel); } + } - static final class BullshitIteratorB implements IBullshit { - public EntityLivingBase mPlayer; - public Entity mEntity; + static final class BullshitIteratorB implements IBullshit { + public EntityLivingBase mPlayer; + public Entity mEntity; - BullshitIteratorB() { - } + BullshitIteratorB() { + } - @Override - public void calculateModifier(Enchantment aEnchantment, int aLevel) { - aEnchantment.func_151368_a(mPlayer, mEntity, aLevel); - } + @Override + public void calculateModifier(Enchantment aEnchantment, int aLevel) { + aEnchantment.func_151368_a(mPlayer, mEntity, aLevel); } } + } +} -}
\ No newline at end of file |