diff --git a/src/main/java/detrav/commands/DetravScannerCommand.java b/src/main/java/detrav/commands/DetravScannerCommand.java index 76c6673be11..783a522aa4d 100644 --- a/src/main/java/detrav/commands/DetravScannerCommand.java +++ b/src/main/java/detrav/commands/DetravScannerCommand.java @@ -47,22 +47,21 @@ public List getCommandAliases() { @Override public void processCommand(ICommandSender sender, String[] args) { - int aX = 0; - int aZ = 0; - int aY = 0; String name = null; ArrayList strs = new ArrayList<>(); for (int i = 0; i < args.length; i++) { strs.add(args[i]); - if (args[i].startsWith("\"")) { - for (i++; i < args.length; i++) { - String temp = (String) strs.get(strs.size() - 1); - temp = temp + " " + args[i]; - temp = temp.replace("\"", ""); - strs.set(strs.size() - 1, temp); - if (args[i].endsWith("\"")) break; - } + if (!args[i].startsWith("\"")) { + continue; + } + + for (i++; i < args.length; i++) { + String temp = (String) strs.get(strs.size() - 1); + temp = temp + " " + args[i]; + temp = temp.replace("\"", ""); + strs.set(strs.size() - 1, temp); + if (args[i].endsWith("\"")) break; } } args = new String[strs.size()]; @@ -72,7 +71,7 @@ public void processCommand(ICommandSender sender, String[] args) { case 0: break; case 1: - if (args[0].toLowerCase() == "help") { + if (args[0].equalsIgnoreCase("help")) { sendHelpMessage(sender); return; } @@ -96,23 +95,28 @@ private void process(ICommandSender sender, int aX, int aZ, String fName) { int ySize = c.getHeightValue(x, z); for (int y = 1; y < ySize; y++) { Block b = c.getBlock(x, y, z); - if (b == GregTechAPI.sBlockOres1) { - TileEntity entity = c.getTileEntityUnsafe(x, y, z); - if (entity != null) { - TileEntityOres gt_entity = (TileEntityOres) entity; - short meta = gt_entity.getMetaData(); - String name = Materials.getLocalizedNameForItem( - GTLanguageManager.getTranslation(b.getUnlocalizedName() + "." + meta + ".name"), - meta % 1000); - if (name.startsWith("Small")) continue; - if (fName == null || name.toLowerCase() - .contains(fName)) { - if (!ores.containsKey(name)) ores.put(name, 1); - else { - int val = ores.get(name); - ores.put(name, val + 1); - } - } + if (b != GregTechAPI.sBlockOres1) { + continue; + } + + TileEntity entity = c.getTileEntityUnsafe(x, y, z); + + if (entity == null) { + continue; + } + + TileEntityOres gt_entity = (TileEntityOres) entity; + short meta = gt_entity.getMetaData(); + String name = Materials.getLocalizedNameForItem( + GTLanguageManager.getTranslation(b.getUnlocalizedName() + "." + meta + ".name"), + meta % 1000); + if (name.startsWith("Small")) continue; + if (fName == null || name.toLowerCase() + .contains(fName)) { + if (!ores.containsKey(name)) ores.put(name, 1); + else { + int val = ores.get(name); + ores.put(name, val + 1); } } } diff --git a/src/main/java/detrav/enums/IDDetraveMetaGeneratedTool01.java b/src/main/java/detrav/enums/IDDetraveMetaGeneratedTool01.java new file mode 100644 index 00000000000..2149252ff39 --- /dev/null +++ b/src/main/java/detrav/enums/IDDetraveMetaGeneratedTool01.java @@ -0,0 +1,25 @@ +package detrav.enums; + +public enum IDDetraveMetaGeneratedTool01 { + + ProspectorScannerULV(0), + ProspectorScannerLV(2), + ProspectorScannerMV(4), + ProspectorScannerHV(6), + ProspectorScannerEV(8), + ProspectorScannerIV(10), + ProspectorScannerLuV(12), + ProspectorScannerZPM(14), + ProspectorScannerUV(16), + ProspectorScannerUHV(18), + ElectricProspectorScannerLuV(100), + ElectricProspectorScannerZPM(102), + ElectricProspectorScannerUV(104), + ElectricProspectorScannerUHV(106),; + + public final int ID; + + private IDDetraveMetaGeneratedTool01(int ID) { + this.ID = ID; + } +} diff --git a/src/main/java/detrav/items/DetravMetaGeneratedTool01.java b/src/main/java/detrav/items/DetravMetaGeneratedTool01.java index c171f56561a..75788a5bfbc 100644 --- a/src/main/java/detrav/items/DetravMetaGeneratedTool01.java +++ b/src/main/java/detrav/items/DetravMetaGeneratedTool01.java @@ -1,9 +1,26 @@ package detrav.items; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ElectricProspectorScannerLuV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ElectricProspectorScannerUHV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ElectricProspectorScannerUV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ElectricProspectorScannerZPM; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerEV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerHV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerIV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerLV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerLuV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerMV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerUHV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerULV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerUV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerZPM; +import static gregtech.api.enums.Mods.NewHorizonsCoreMod; + import java.util.List; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -16,7 +33,6 @@ import detrav.items.tools.DetravToolElectricProspector; import gregtech.api.enums.GTValues; import gregtech.api.enums.Materials; -import gregtech.api.enums.Mods; import gregtech.api.enums.TCAspects; import gregtech.api.interfaces.IToolStats; import gregtech.api.items.MetaGeneratedTool; @@ -32,7 +48,7 @@ public DetravMetaGeneratedTool01() { super("detrav.metatool.01"); INSTANCE = this; addTool( - 0, + ProspectorScannerULV.ID, "Prospector's Scanner(ULV)", "", new DetravProspector(0), @@ -41,7 +57,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.PERFODIO, 4L)); addTool( - 2, + ProspectorScannerLV.ID, "Prospector's Scanner(LV)", "", new DetravProspector(1), @@ -50,7 +66,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.PERFODIO, 4L)); addTool( - 4, + ProspectorScannerMV.ID, "Prospector's Scanner(MV)", "", new DetravProspector(2), @@ -59,7 +75,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.PERFODIO, 4L)); addTool( - 6, + ProspectorScannerHV.ID, "Prospector's Scanner(HV)", "", new DetravProspector(3), @@ -68,7 +84,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.PERFODIO, 4L)); addTool( - 8, + ProspectorScannerEV.ID, "Prospector's Scanner(EV)", "", new DetravProspector(4), @@ -77,7 +93,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.PERFODIO, 4L)); addTool( - 10, + ProspectorScannerIV.ID, "Prospector's Scanner(IV)", "", new DetravProspector(5), @@ -86,7 +102,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.PERFODIO, 4L)); addTool( - 12, + ProspectorScannerLuV.ID, "Prospector's Scanner(LuV)", "", new DetravProspector(6), @@ -95,7 +111,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.PERFODIO, 4L)); addTool( - 14, + ProspectorScannerZPM.ID, "Prospector's Scanner(ZPM)", "", new DetravProspector(7), @@ -104,7 +120,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.PERFODIO, 4L)); addTool( - 16, + ProspectorScannerUV.ID, "Prospector's Scanner(UV)", "", new DetravProspector(8), @@ -113,7 +129,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.PERFODIO, 4L)); addTool( - 18, + ProspectorScannerUHV.ID, "Prospector's Scanner(UHV)", "", new DetravProspector(9), @@ -123,7 +139,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.PERFODIO, 4L)); addTool( - 100, + ElectricProspectorScannerLuV.ID, "Electric Prospector's Scanner (LuV)", "", new DetravToolElectricProspector(6), @@ -132,7 +148,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.ELECTRUM, 4L)); addTool( - 102, + ElectricProspectorScannerZPM.ID, "Electric Prospector's Scanner (ZPM)", "", new DetravToolElectricProspector(7), @@ -141,7 +157,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.ELECTRUM, 4L)); addTool( - 104, + ElectricProspectorScannerUV.ID, "Electric Prospector's Scanner (UV)", "", new DetravToolElectricProspector(8), @@ -150,7 +166,7 @@ public DetravMetaGeneratedTool01() { new TCAspects.TC_AspectStack(TCAspects.METALLUM, 4L), new TCAspects.TC_AspectStack(TCAspects.ELECTRUM, 4L)); addTool( - 106, + ElectricProspectorScannerUHV.ID, "Electric Prospector's Scanner (UHV)", "", new DetravToolElectricProspector(9), @@ -169,32 +185,30 @@ public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPl int tOffset = aList.size(); if (tStats == null) return; - String name = aStack.getUnlocalizedName(); - String num = name.substring("gt.detrav.metatool.01.".length()); - int meta = Integer.parseInt(num); + int meta = Items.feather.getDamage(aStack); + + // range in chunks int range = getHarvestLevel(aStack, "") / 2 + (meta / 4); if ((range % 2) == 0) { range += 1; } + if (meta < 100) { aList.add( - tOffset + 0, + tOffset, EnumChatFormatting.WHITE + StatCollector.translateToLocal("tooltip.detrav.scanner.durability") + EnumChatFormatting.GREEN - + Long.toString(tMaxDamage - getToolDamage(aStack)) + + (tMaxDamage - getToolDamage(aStack)) + " / " - + Long.toString(tMaxDamage) + + tMaxDamage + EnumChatFormatting.GRAY); aList.add( tOffset + 1, EnumChatFormatting.WHITE + tMaterial.getLocalizedNameForItem("%material") + EnumChatFormatting.GRAY); aList.add( tOffset + 2, - EnumChatFormatting.WHITE + StatCollector.translateToLocal("tooltip.detrav.scanner.range") - + Integer.toString(range) - + "x" - + Integer.toString(range) - + EnumChatFormatting.GRAY); + EnumChatFormatting.WHITE + StatCollector + .translateToLocal("tooltip.detrav.scanner.range") + range + "x" + range + EnumChatFormatting.GRAY); aList.add( tOffset + 3, EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.usage.0") @@ -207,7 +221,7 @@ public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPl tOffset + 5, EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.success.chance") + EnumChatFormatting.RESET - + Integer.toString(((((1 + meta) * 8) <= 100) ? ((1 + meta) * 8) : 100)) + + (Math.min(((1 + meta) * 8), 100)) + EnumChatFormatting.GRAY + "%"); aList.add( @@ -216,44 +230,45 @@ public void addAdditionalToolTips(List aList, ItemStack aStack, EntityPlayer aPl aList.add( tOffset + 7, EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.distance.1")); + return; - } else if (meta >= 100 && meta < 200) { - aList.add( - tOffset + 0, - EnumChatFormatting.WHITE + StatCollector.translateToLocal("tooltip.detrav.scanner.durability") - + EnumChatFormatting.GREEN - + (tMaxDamage - getToolDamage(aStack)) - + " / " - + tMaxDamage - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 1, - EnumChatFormatting.WHITE + tMaterial.getLocalizedNameForItem("%material") + EnumChatFormatting.GRAY); - aList.add( - tOffset + 2, - EnumChatFormatting.WHITE + StatCollector.translateToLocal("tooltip.detrav.scanner.range") - + EnumChatFormatting.YELLOW - + (getHarvestLevel(aStack, "") * 2 + 1) - + "x" - + (getHarvestLevel(aStack, "") * 2 + 1) - + EnumChatFormatting.GRAY); - aList.add( - tOffset + 3, - EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.usage.0")); - aList.add( - tOffset + 4, - EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.usage.1")); - aList.add( - tOffset + 5, - EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.usage.2")); - aList.add( - tOffset + 6, - EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.usage.3")); - aList.add( - tOffset + 7, - EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.usage.4")); } + // from here, it's for the electric prospector scanners + aList.add( + tOffset + 0, + EnumChatFormatting.WHITE + StatCollector.translateToLocal("tooltip.detrav.scanner.durability") + + EnumChatFormatting.GREEN + + (tMaxDamage - getToolDamage(aStack)) + + " / " + + tMaxDamage + + EnumChatFormatting.GRAY); + aList.add( + tOffset + 1, + EnumChatFormatting.WHITE + tMaterial.getLocalizedNameForItem("%material") + EnumChatFormatting.GRAY); + aList.add( + tOffset + 2, + EnumChatFormatting.WHITE + StatCollector.translateToLocal("tooltip.detrav.scanner.range") + + EnumChatFormatting.YELLOW + + (getHarvestLevel(aStack, "") * 2 + 1) + + "x" + + (getHarvestLevel(aStack, "") * 2 + 1) + + EnumChatFormatting.GRAY); + aList.add( + tOffset + 3, + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.usage.0")); + aList.add( + tOffset + 4, + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.usage.1")); + aList.add( + tOffset + 5, + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.usage.2")); + aList.add( + tOffset + 6, + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.usage.3")); + aList.add( + tOffset + 7, + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("tooltip.detrav.scanner.usage.4")); } public Long getToolGTDetravData(ItemStack aStack) { @@ -281,37 +296,70 @@ public boolean setToolGTDetravData(ItemStack aStack, long data) { public void getDetravSubItems(Item item, CreativeTabs detravCreativeTab, List list) { ItemStack dStack; - if (Mods.NewHorizonsCoreMod.isModLoaded()) { + if (NewHorizonsCoreMod.isModLoaded()) { // Materials at tiers - list.add(getToolWithStats(0, 1, Materials.Polycaprolactam, Materials.Polycaprolactam, null)); - list.add(getToolWithStats(2, 1, Materials.Steel, Materials.Steel, null)); - list.add(getToolWithStats(2, 1, Materials.Bronze, Materials.Steel, null)); - list.add(getToolWithStats(4, 1, Materials.Manyullyn, Materials.Aluminium, null)); - list.add(getToolWithStats(6, 1, Materials.DamascusSteel, Materials.DamascusSteel, null)); - list.add(getToolWithStats(8, 1, Materials.Titanium, Materials.Titanium, null)); - list.add(getToolWithStats(10, 1, Materials.TungstenSteel, Materials.TungstenSteel, null)); - list.add(getToolWithStats(12, 1, Materials.Iridium, Materials.Iridium, null)); - list.add(getToolWithStats(12, 1, Materials.Osmium, Materials.Osmium, null)); - list.add(getToolWithStats(14, 1, Materials.Neutronium, Materials.Neutronium, null)); - list.add(getToolWithStats(16, 1, Materials.InfinityCatalyst, Materials.InfinityCatalyst, null)); - list.add(getToolWithStats(18, 1, Materials.Infinity, Materials.Infinity, null)); + list.add( + getToolWithStats( + ProspectorScannerULV.ID, + 1, + Materials.Polycaprolactam, + Materials.Polycaprolactam, + null)); + list.add(getToolWithStats(ProspectorScannerLV.ID, 1, Materials.Steel, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerLV.ID, 1, Materials.Bronze, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerMV.ID, 1, Materials.Manyullyn, Materials.Aluminium, null)); + list.add( + getToolWithStats(ProspectorScannerHV.ID, 1, Materials.DamascusSteel, Materials.DamascusSteel, null)); + list.add(getToolWithStats(ProspectorScannerEV.ID, 1, Materials.Titanium, Materials.Titanium, null)); + list.add( + getToolWithStats(ProspectorScannerIV.ID, 1, Materials.TungstenSteel, Materials.TungstenSteel, null)); + list.add(getToolWithStats(ProspectorScannerLuV.ID, 1, Materials.Iridium, Materials.Iridium, null)); + list.add(getToolWithStats(ProspectorScannerLuV.ID, 1, Materials.Osmium, Materials.Osmium, null)); + list.add(getToolWithStats(ProspectorScannerZPM.ID, 1, Materials.Neutronium, Materials.Neutronium, null)); + list.add( + getToolWithStats( + ProspectorScannerUV.ID, + 1, + Materials.InfinityCatalyst, + Materials.InfinityCatalyst, + null)); + list.add(getToolWithStats(ProspectorScannerUHV.ID, 1, Materials.Infinity, Materials.Infinity, null)); + + // electric prospector scanners: + dStack = getToolWithStats( + ElectricProspectorScannerUV.ID, + 1, + Materials.InfinityCatalyst, + Materials.TungstenSteel, + new long[] { 1638400000L, GTValues.V[8], 8L, -1L }); + setCharge(dStack, 1638400000L); + list.add(dStack); + + dStack = getToolWithStats( + ElectricProspectorScannerUHV.ID, + 1, + Materials.Infinity, + Materials.TungstenSteel, + new long[] { 6553600000L, GTValues.V[9], 9L, -1L }); + setCharge(dStack, 6553600000L); + list.add(dStack); } // Steel for comparison - list.add(getToolWithStats(0, 1, Materials.Steel, Materials.Steel, null)); - list.add(getToolWithStats(2, 1, Materials.Steel, Materials.Steel, null)); - list.add(getToolWithStats(4, 1, Materials.Steel, Materials.Steel, null)); - list.add(getToolWithStats(6, 1, Materials.Steel, Materials.Steel, null)); - list.add(getToolWithStats(8, 1, Materials.Steel, Materials.Steel, null)); - list.add(getToolWithStats(10, 1, Materials.Steel, Materials.Steel, null)); - list.add(getToolWithStats(12, 1, Materials.Steel, Materials.Steel, null)); - list.add(getToolWithStats(14, 1, Materials.Steel, Materials.Steel, null)); - list.add(getToolWithStats(16, 1, Materials.Steel, Materials.Steel, null)); - list.add(getToolWithStats(18, 1, Materials.Steel, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerULV.ID, 1, Materials.Steel, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerLV.ID, 1, Materials.Steel, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerMV.ID, 1, Materials.Steel, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerHV.ID, 1, Materials.Steel, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerEV.ID, 1, Materials.Steel, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerIV.ID, 1, Materials.Steel, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerLuV.ID, 1, Materials.Steel, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerZPM.ID, 1, Materials.Steel, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerUV.ID, 1, Materials.Steel, Materials.Steel, null)); + list.add(getToolWithStats(ProspectorScannerUHV.ID, 1, Materials.Steel, Materials.Steel, null)); // Electric Scanners dStack = getToolWithStats( - 100, + ElectricProspectorScannerLuV.ID, 1, Materials.Iridium, Materials.TungstenSteel, @@ -320,7 +368,7 @@ public void getDetravSubItems(Item item, CreativeTabs detravCreativeTab, List li list.add(dStack); dStack = getToolWithStats( - 102, + ElectricProspectorScannerZPM.ID, 1, Materials.Neutronium, Materials.TungstenSteel, @@ -328,33 +376,13 @@ public void getDetravSubItems(Item item, CreativeTabs detravCreativeTab, List li setCharge(dStack, 409600000L); list.add(dStack); - if (Mods.NewHorizonsCoreMod.isModLoaded()) { - dStack = getToolWithStats( - 104, - 1, - Materials.InfinityCatalyst, - Materials.TungstenSteel, - new long[] { 1638400000L, GTValues.V[8], 8L, -1L }); - setCharge(dStack, 1638400000L); - list.add(dStack); - - dStack = getToolWithStats( - 106, - 1, - Materials.Infinity, - Materials.TungstenSteel, - new long[] { 6553600000L, GTValues.V[9], 9L, -1L }); - setCharge(dStack, 6553600000L); - list.add(dStack); - } else { - dStack = getToolWithStats( - 106, - 1, - Materials.Neutronium, - Materials.TungstenSteel, - new long[] { 6553600000L, GTValues.V[9], 9L, -1L }); - setCharge(dStack, 6553600000L); - list.add(dStack); - } + dStack = getToolWithStats( + ElectricProspectorScannerUHV.ID, + 1, + Materials.Neutronium, + Materials.TungstenSteel, + new long[] { 6553600000L, GTValues.V[9], 9L, -1L }); + setCharge(dStack, 6553600000L); + list.add(dStack); } } diff --git a/src/main/java/detrav/items/behaviours/BehaviourDetravToolElectricProspector.java b/src/main/java/detrav/items/behaviours/BehaviourDetravToolElectricProspector.java index 56f97ea8622..04b1c47cf62 100644 --- a/src/main/java/detrav/items/behaviours/BehaviourDetravToolElectricProspector.java +++ b/src/main/java/detrav/items/behaviours/BehaviourDetravToolElectricProspector.java @@ -1,5 +1,7 @@ package detrav.items.behaviours; +import static gregtech.api.enums.Mods.VisualProspecting; + import java.util.ArrayList; import java.util.List; @@ -22,7 +24,6 @@ import detrav.net.ProspectingPacket; import detrav.utils.BartWorksHelper; import detrav.utils.GTppHelper; -import gregtech.api.enums.Mods; import gregtech.api.items.MetaBaseItem; import gregtech.api.objects.ItemData; import gregtech.api.util.GTLanguageManager; @@ -47,29 +48,10 @@ public ItemStack onItemRightClick(MetaBaseItem aItem, ItemStack aStack, World aW if (aPlayer.isSneaking()) { data++; if (data > 3) data = 0; - switch (data) { - case 0: - aPlayer.addChatMessage( - new ChatComponentText(StatCollector.translateToLocal("detrav.scanner.mode.0"))); - break; - case 1: - aPlayer.addChatMessage( - new ChatComponentText(StatCollector.translateToLocal("detrav.scanner.mode.1"))); - break; - case 2: - aPlayer.addChatMessage( - new ChatComponentText(StatCollector.translateToLocal("detrav.scanner.mode.2"))); - break; - case 3: - aPlayer.addChatMessage( - new ChatComponentText(StatCollector.translateToLocal("detrav.scanner.mode.3"))); - break; - default: - aPlayer.addChatMessage( - new ChatComponentText(StatCollector.translateToLocal("detrav.scanner.mode.error"))); - break; - } - DetravMetaGeneratedTool01.INSTANCE.setToolGTDetravData(aStack, (long) data); + aPlayer.addChatMessage( + new ChatComponentText(StatCollector.translateToLocal("detrav.scanner.mode." + data))); + + DetravMetaGeneratedTool01.INSTANCE.setToolGTDetravData(aStack, data); return super.onItemRightClick(aItem, aStack, aWorld, aPlayer); } @@ -98,15 +80,14 @@ public ItemStack onItemRightClick(MetaBaseItem aItem, ItemStack aStack, World aW final int ySize = c.getHeightValue(x, z); for (int y = 1; y < ySize; y++) { switch (data) { - case 0: - case 1: + case 0, 1 -> { final Block tBlock = c.getBlock(x, y, z); short tMetaID = (short) c.getBlockMetadata(x, y, z); if (tBlock instanceof BlockOresAbstract) { TileEntity tTileEntity = c.getTileEntityUnsafe(x, y, z); if ((tTileEntity instanceof TileEntityOres) && ((TileEntityOres) tTileEntity).mNatural) { - tMetaID = (short) ((TileEntityOres) tTileEntity).getMetaData(); + tMetaID = ((TileEntityOres) tTileEntity).getMetaData(); try { String name = GTLanguageManager .getTranslation(tBlock.getUnlocalizedName() + "." + tMetaID + ".name"); @@ -143,8 +124,8 @@ public ItemStack onItemRightClick(MetaBaseItem aItem, ItemStack aStack, World aW (short) tAssotiation.mMaterial.mMaterial.mMetaItemSubID); } } - break; - case 2: + } + case 2 -> { if ((x == 0) || (z == 0)) { // Skip doing the locations with the grid on them. break; } @@ -160,9 +141,9 @@ public ItemStack onItemRightClick(MetaBaseItem aItem, ItemStack aStack, World aW packet .addBlock(c.xPosition * 16 + x, 2, c.zPosition * 16 + z, (short) fStack.amount); } - break; - case 3: - float polution = (float) getPolution( + } + case 3 -> { + float polution = (float) getPollution( aWorld, c.xPosition * 16 + x, c.zPosition * 16 + z); @@ -171,17 +152,17 @@ public ItemStack onItemRightClick(MetaBaseItem aItem, ItemStack aStack, World aW if (polution > 0xFF) polution = 0xFF; polution = 0xFF - polution; packet.addBlock(c.xPosition * 16 + x, 1, c.zPosition * 16 + z, (short) polution); - break; + } } if (data > 1) break; } } } - packet.level = ((DetravMetaGeneratedTool01) aItem).getHarvestLevel(aStack, ""); + packet.level = aItem.getHarvestLevel(aStack, ""); DetravNetwork.INSTANCE.sendToPlayer(packet, (EntityPlayerMP) aPlayer); if (!aPlayer.capabilities.isCreativeMode) tool.doDamage(aStack, this.mCosts * chunks.size()); - if (Mods.VisualProspecting.isModLoaded()) { + if (VisualProspecting.isModLoaded()) { if (data == 0 || data == 1) { VisualProspecting_API.LogicalServer.sendProspectionResultsToClient( (EntityPlayerMP) aPlayer, @@ -228,13 +209,12 @@ public boolean onItemUse(MetaBaseItem aItem, ItemStack aStack, EntityPlayer aPla if (!aPlayer.capabilities.isCreativeMode) ((DetravMetaGeneratedTool01) aItem).doDamage(aStack, this.mCosts); } - return true; } else { if (!aWorld.isRemote) { - prospectSingleChunk((DetravMetaGeneratedTool01) aItem, aStack, aPlayer, aWorld, aX, aY, aZ); + prospectSingleChunk(aItem, aStack, aPlayer, aWorld, aX, aY, aZ); } - return true; } + return true; } if (data < 3) if (!aWorld.isRemote) { FluidStack fStack = UndergroundOil.undergroundOil(aWorld.getChunkFromBlockCoords(aX, aZ), -1); @@ -243,7 +223,7 @@ public boolean onItemUse(MetaBaseItem aItem, ItemStack aStack, EntityPlayer aPla return true; } if (!aWorld.isRemote) { - int polution = getPolution(aWorld, aX, aZ); + int polution = getPollution(aWorld, aX, aZ); addChatMassageByValue(aPlayer, polution, "Pollution"); } return true; diff --git a/src/main/java/detrav/items/behaviours/BehaviourDetravToolProspector.java b/src/main/java/detrav/items/behaviours/BehaviourDetravToolProspector.java index 45b4c7fb296..7038d42817d 100644 --- a/src/main/java/detrav/items/behaviours/BehaviourDetravToolProspector.java +++ b/src/main/java/detrav/items/behaviours/BehaviourDetravToolProspector.java @@ -1,5 +1,7 @@ package detrav.items.behaviours; +import static gregtech.api.enums.Mods.VisualProspecting; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -30,7 +32,6 @@ import detrav.utils.GTppHelper; import gregtech.api.GregTechAPI; import gregtech.api.enums.Materials; -import gregtech.api.enums.Mods; import gregtech.api.items.MetaBaseItem; import gregtech.api.objects.ItemData; import gregtech.api.util.GTLanguageManager; @@ -64,7 +65,7 @@ public boolean onItemUse(MetaBaseItem aItem, ItemStack aStack, EntityPlayer aPla int aZ, int aSide, float hitX, float hitY, float hitZ) { SplittableRandom aRandom = new SplittableRandom(); - int chance = ((1 + aStack.getItemDamage()) * 8) > 100 ? 100 : (1 + aStack.getItemDamage()) * 8; + int chance = Math.min(((1 + aStack.getItemDamage()) * 8), 100); if (aWorld.isRemote) return false; @@ -82,7 +83,7 @@ public boolean onItemUse(MetaBaseItem aItem, ItemStack aStack, EntityPlayer aPla if (!aPlayer.capabilities.isCreativeMode) ((DetravMetaGeneratedTool01) aItem).doDamage(aStack, this.mCosts); - if (Mods.VisualProspecting.isModLoaded()) { + if (VisualProspecting.isModLoaded()) { VisualProspecting_API.LogicalServer.sendProspectionResultsToClient( (EntityPlayerMP) aPlayer, new ArrayList<>(), @@ -213,7 +214,7 @@ protected void prospectChunks(MetaBaseItem aItem, ItemStack aStack, EntityPlayer aPlayer.addChatMessage(msg); } - if (Mods.VisualProspecting.isModLoaded()) { + if (VisualProspecting.isModLoaded()) { VisualProspecting_API.LogicalServer.sendProspectionResultsToClient( (EntityPlayerMP) aPlayer, VisualProspecting_API.LogicalServer.prospectOreVeinsWithinRadius( @@ -249,7 +250,7 @@ protected void prospectSingleChunk(MetaBaseItem aItem, ItemStack aStack, EntityP addChatMassageByValue(aPlayer, value, key); } - if (Mods.VisualProspecting.isModLoaded()) { + if (VisualProspecting.isModLoaded()) { VisualProspecting_API.LogicalServer.sendProspectionResultsToClient( (EntityPlayerMP) aPlayer, VisualProspecting_API.LogicalServer.prospectOreVeinsWithinRadius( @@ -266,8 +267,7 @@ protected void processOreProspecting(DetravMetaGeneratedTool01 aItem, ItemStack // aTileEntity) { if (aTileEntity != null) { - if (aTileEntity instanceof TileEntityOres) { - TileEntityOres gt_entity = (TileEntityOres) aTileEntity; + if (aTileEntity instanceof TileEntityOres gt_entity) { short meta = gt_entity.getMetaData(); String format = LanguageRegistry.instance() .getStringLocalization("gt.blockores." + meta + ".name"); @@ -414,7 +414,7 @@ else if (value < 100) chatMessageList .add(new ChatComponentText(name + StatCollector.translateToLocal("detrav.scanner.found.texts.5"))); } - public static int getPolution(World aWorld, int aX, int aZ) { + public static int getPollution(World aWorld, int aX, int aZ) { return Pollution.getPollution(aWorld.getChunkFromBlockCoords(aX, aZ)); } } diff --git a/src/main/java/detrav/items/processing/ProcessingDetravToolProspector.java b/src/main/java/detrav/items/processing/ProcessingDetravToolProspector.java index 4ae83edc726..85d31927803 100644 --- a/src/main/java/detrav/items/processing/ProcessingDetravToolProspector.java +++ b/src/main/java/detrav/items/processing/ProcessingDetravToolProspector.java @@ -1,5 +1,15 @@ package detrav.items.processing; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerEV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerHV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerIV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerLV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerLuV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerMV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerUHV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerUV; +import static detrav.enums.IDDetraveMetaGeneratedTool01.ProspectorScannerZPM; + import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -23,107 +33,109 @@ public void registerOre(OrePrefixes aPrefix, Materials material, String aOreDict ItemStack aStack) { if (!aPrefix.doGenerateItem(material)) return; if (DetravScannerMod.DEBUG_ENABLED) return; - try { - // ULV disabled - // GTModHandler.addCraftingRecipe(DetravMetaGeneratedTool01.INSTANCE.getToolWithStats(0, 1, aMaterial, - // Materials.Lead, null), GTModHandler.RecipeBits.DISMANTLEABLE | - // GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GTModHandler.RecipeBits.BUFFERED, new - // Object[]{"SHE","CPC","PXP",'E',OreDictionary.getOres("cellSulfuricAcid").get(0),'S',OreDictionary.getOres("cellHydroxide").get(0),'H',OrePrefixes.toolHeadDrill.get(aMaterial),'P',OrePrefixes.plate.get(aMaterial),'C',OrePrefixes.circuit.get(Materials.Primitive),'X',gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList.Sensor_ULV}); - GTModHandler.addCraftingRecipe( - DetravMetaGeneratedTool01.INSTANCE.getToolWithStats(2, 1, material, Materials.Steel, null), - GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | GTModHandler.RecipeBits.BUFFERED, - new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellSulfuricAcid") - .get(0), 'S', - OreDictionary.getOres("cellHydroxide") - .get(0), - 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', - OrePrefixes.circuit.get(Materials.Basic), 'X', ItemList.Sensor_LV }); - GTModHandler.addCraftingRecipe( - DetravMetaGeneratedTool01.INSTANCE.getToolWithStats(4, 1, material, Materials.Steel, null), - GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | GTModHandler.RecipeBits.BUFFERED, - new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellSulfuricAcid") - .get(0), 'S', - OreDictionary.getOres("cellHydroxide") - .get(0), - 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', - OrePrefixes.circuit.get(Materials.Good), 'X', ItemList.Sensor_MV }); - GTModHandler.addCraftingRecipe( - DetravMetaGeneratedTool01.INSTANCE.getToolWithStats(6, 1, material, Materials.Steel, null), - GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | GTModHandler.RecipeBits.BUFFERED, - new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellNitricAcid") - .get(0), 'S', - OreDictionary.getOres("cellSodiumPersulfate") - .get(0), - 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', - OrePrefixes.circuit.get(Materials.Advanced), 'X', ItemList.Sensor_HV }); - GTModHandler.addCraftingRecipe( - DetravMetaGeneratedTool01.INSTANCE.getToolWithStats(8, 1, material, Materials.Steel, null), - GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | GTModHandler.RecipeBits.BUFFERED, - new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellNitricAcid") - .get(0), 'S', - OreDictionary.getOres("cellSodiumPersulfate") - .get(0), - 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', - OrePrefixes.circuit.get(Materials.Data), 'X', ItemList.Sensor_EV }); - GTModHandler.addCraftingRecipe( - DetravMetaGeneratedTool01.INSTANCE.getToolWithStats(10, 1, material, Materials.Steel, null), - GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | GTModHandler.RecipeBits.BUFFERED, - new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellNitricAcid") - .get(0), 'S', - OreDictionary.getOres("cellSodiumPersulfate") - .get(0), - 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', - OrePrefixes.circuit.get(Materials.Elite), 'X', ItemList.Sensor_IV }); + GTModHandler.addCraftingRecipe( + DetravMetaGeneratedTool01.INSTANCE + .getToolWithStats(ProspectorScannerLV.ID, 1, material, Materials.Steel, null), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellSulfuricAcid") + .get(0), 'S', + OreDictionary.getOres("cellHydroxide") + .get(0), + 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', + OrePrefixes.circuit.get(Materials.LV), 'X', ItemList.Sensor_LV }); + GTModHandler.addCraftingRecipe( + DetravMetaGeneratedTool01.INSTANCE + .getToolWithStats(ProspectorScannerMV.ID, 1, material, Materials.Steel, null), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellSulfuricAcid") + .get(0), 'S', + OreDictionary.getOres("cellHydroxide") + .get(0), + 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', + OrePrefixes.circuit.get(Materials.MV), 'X', ItemList.Sensor_MV }); - GTModHandler.addCraftingRecipe( - DetravMetaGeneratedTool01.INSTANCE.getToolWithStats(12, 1, material, Materials.Steel, null), - GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | GTModHandler.RecipeBits.BUFFERED, - new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellHydrofluoricAcid") - .get(0), 'S', - OreDictionary.getOres("cellLithiumPeroxide") - .get(0), - 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', - OrePrefixes.circuit.get(Materials.Master), 'X', ItemList.Sensor_LuV }); - GTModHandler.addCraftingRecipe( - DetravMetaGeneratedTool01.INSTANCE.getToolWithStats(14, 1, material, Materials.Steel, null), - GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | GTModHandler.RecipeBits.BUFFERED, - new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellHydrofluoricAcid") - .get(0), 'S', - OreDictionary.getOres("cellLithiumPeroxide") - .get(0), - 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', - OrePrefixes.circuit.get(Materials.Ultimate), 'X', ItemList.Sensor_ZPM }); - GTModHandler.addCraftingRecipe( - DetravMetaGeneratedTool01.INSTANCE.getToolWithStats(16, 1, material, Materials.Steel, null), - GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | GTModHandler.RecipeBits.BUFFERED, - new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellHydrofluoricAcid") - .get(0), 'S', - OreDictionary.getOres("cellLithiumPeroxide") - .get(0), - 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', - OrePrefixes.circuit.get(Materials.SuperconductorUHV), 'X', ItemList.Sensor_UV }); + GTModHandler.addCraftingRecipe( + DetravMetaGeneratedTool01.INSTANCE + .getToolWithStats(ProspectorScannerHV.ID, 1, material, Materials.Steel, null), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellNitricAcid") + .get(0), 'S', + OreDictionary.getOres("cellSodiumPersulfate") + .get(0), + 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', + OrePrefixes.circuit.get(Materials.HV), 'X', ItemList.Sensor_HV }); + GTModHandler.addCraftingRecipe( + DetravMetaGeneratedTool01.INSTANCE + .getToolWithStats(ProspectorScannerEV.ID, 1, material, Materials.Steel, null), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellNitricAcid") + .get(0), 'S', + OreDictionary.getOres("cellSodiumPersulfate") + .get(0), + 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', + OrePrefixes.circuit.get(Materials.EV), 'X', ItemList.Sensor_EV }); + GTModHandler.addCraftingRecipe( + DetravMetaGeneratedTool01.INSTANCE + .getToolWithStats(ProspectorScannerIV.ID, 1, material, Materials.Steel, null), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellNitricAcid") + .get(0), 'S', + OreDictionary.getOres("cellSodiumPersulfate") + .get(0), + 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', + OrePrefixes.circuit.get(Materials.IV), 'X', ItemList.Sensor_IV }); - GTModHandler.addCraftingRecipe( - DetravMetaGeneratedTool01.INSTANCE.getToolWithStats(18, 1, material, Materials.Steel, null), - GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS - | GTModHandler.RecipeBits.BUFFERED, - new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellHydrofluoricAcid") - .get(0), 'S', - OreDictionary.getOres("cellHydrogenPeroxide") - .get(0), - 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', - OrePrefixes.circuit.get(Materials.Infinite), 'X', ItemList.Sensor_UHV }); + GTModHandler.addCraftingRecipe( + DetravMetaGeneratedTool01.INSTANCE + .getToolWithStats(ProspectorScannerLuV.ID, 1, material, Materials.Steel, null), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellHydrofluoricAcid") + .get(0), 'S', + OreDictionary.getOres("cellLithiumPeroxide") + .get(0), + 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', + OrePrefixes.circuit.get(Materials.LuV), 'X', ItemList.Sensor_LuV }); + GTModHandler.addCraftingRecipe( + DetravMetaGeneratedTool01.INSTANCE + .getToolWithStats(ProspectorScannerZPM.ID, 1, material, Materials.Steel, null), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellHydrofluoricAcid") + .get(0), 'S', + OreDictionary.getOres("cellLithiumPeroxide") + .get(0), + 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', + OrePrefixes.circuit.get(Materials.ZPM), 'X', ItemList.Sensor_ZPM }); + GTModHandler.addCraftingRecipe( + DetravMetaGeneratedTool01.INSTANCE + .getToolWithStats(ProspectorScannerUV.ID, 1, material, Materials.Steel, null), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellHydrofluoricAcid") + .get(0), 'S', + OreDictionary.getOres("cellLithiumPeroxide") + .get(0), + 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', + OrePrefixes.circuit.get(Materials.UV), 'X', ItemList.Sensor_UV }); - } catch (Exception ignored) {} + GTModHandler.addCraftingRecipe( + DetravMetaGeneratedTool01.INSTANCE + .getToolWithStats(ProspectorScannerUHV.ID, 1, material, Materials.Steel, null), + GTModHandler.RecipeBits.DISMANTLEABLE | GTModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS + | GTModHandler.RecipeBits.BUFFERED, + new Object[] { "SHE", "CPC", "PXP", 'E', OreDictionary.getOres("cellHydrofluoricAcid") + .get(0), 'S', + OreDictionary.getOres("cellHydrogenPeroxide") + .get(0), + 'H', OrePrefixes.toolHeadDrill.get(material), 'P', OrePrefixes.plate.get(material), 'C', + OrePrefixes.circuit.get(Materials.UHV), 'X', ItemList.Sensor_UHV }); } } diff --git a/src/main/java/detrav/items/tools/DetravProspector.java b/src/main/java/detrav/items/tools/DetravProspector.java index 63eb0e14520..6bc09f2056f 100644 --- a/src/main/java/detrav/items/tools/DetravProspector.java +++ b/src/main/java/detrav/items/tools/DetravProspector.java @@ -19,9 +19,10 @@ public int getBaseQuality() { return tier; } + @Override public float getMaxDurabilityMultiplier() { double x = tier + 1; - return (float) (((float) 0.005D + Math.tanh(Math.pow(x, (x / 8D)) / 25D) * (x / 6D)) * 1.25); + return (float) (0.00625D + (1.25D * x / 6D) * Math.tanh(Math.pow(x, (x / 8D)) / 25D)); } public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { diff --git a/src/main/java/detrav/items/tools/DetravToolElectricProspector.java b/src/main/java/detrav/items/tools/DetravToolElectricProspector.java index abe5259036a..f1e38c5ba4f 100644 --- a/src/main/java/detrav/items/tools/DetravToolElectricProspector.java +++ b/src/main/java/detrav/items/tools/DetravToolElectricProspector.java @@ -21,8 +21,8 @@ public int getBaseQuality() { } public float getMaxDurabilityMultiplier() { - if (tier - 6 == 0) return (float) Math.pow(((float) ((tier - 6F) * 2F)), 0.0D); - else return (float) ((tier - 6F) * 2F); + if (tier - 6 == 0) return 1.0F; + else return (tier - 6F) * 2F; } public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { diff --git a/src/main/java/detrav/items/tools/DetravToolElectricProspectorBase.java b/src/main/java/detrav/items/tools/DetravToolElectricProspectorBase.java index f73344fc6ba..66d38c39ea9 100644 --- a/src/main/java/detrav/items/tools/DetravToolElectricProspectorBase.java +++ b/src/main/java/detrav/items/tools/DetravToolElectricProspectorBase.java @@ -18,8 +18,8 @@ import detrav.enums.Textures01; import detrav.items.behaviours.BehaviourDetravToolElectricProspector; -import gregtech.api.GregTechAPI; import gregtech.api.damagesources.GTDamageSources; +import gregtech.api.enums.SoundResource; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.IToolStats; import gregtech.api.items.MetaGeneratedTool; @@ -83,7 +83,7 @@ public String getEntityHitSound() { } public String getBreakingSound() { - return (String) GregTechAPI.sSoundList.get(0); + return SoundResource.RANDOM_BREAK.toString(); } @Override diff --git a/src/main/java/detrav/proxies/ClientProxy.java b/src/main/java/detrav/proxies/ClientProxy.java index fa0aac05b0e..cb23fed0a5e 100644 --- a/src/main/java/detrav/proxies/ClientProxy.java +++ b/src/main/java/detrav/proxies/ClientProxy.java @@ -13,6 +13,7 @@ public class ClientProxy extends CommonProxy { public ClientProxy() { + // if removed, textures are somehow not loaded in the game. int test = Textures01.mTextures.length; } diff --git a/src/main/java/detrav/proxies/CommonProxy.java b/src/main/java/detrav/proxies/CommonProxy.java index f8e0500eea7..9df2179b711 100644 --- a/src/main/java/detrav/proxies/CommonProxy.java +++ b/src/main/java/detrav/proxies/CommonProxy.java @@ -22,22 +22,15 @@ public void onPostLoad() { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - switch (ID) { - case DetravScannerGUI.GUI_ID: - return null; - default: - return null; - } + return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - switch (ID) { - case DetravScannerGUI.GUI_ID: - return new DetravScannerGUI(); - default: - return null; + if (ID == DetravScannerGUI.GUI_ID) { + return new DetravScannerGUI(); } + return null; } public void openProspectorGUI() { diff --git a/src/main/java/detrav/utils/FluidColors.java b/src/main/java/detrav/utils/FluidColors.java index 3bb52bb76bb..6d18a3addae 100644 --- a/src/main/java/detrav/utils/FluidColors.java +++ b/src/main/java/detrav/utils/FluidColors.java @@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.Objects; +import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import gregtech.api.enums.Materials; @@ -15,12 +16,8 @@ public static void makeColors() { reFillFluidColors(); - // ProgressManager.ProgressBar progressBar = ProgressManager.push("Making Fluid Colors", (int) - // (Materials.values().length + - // FluidRegistry.getRegisteredFluids().values().stream().filter(Objects::nonNull).count())); Arrays.stream(Materials.values()) .forEach(mat -> { - // progressBar.step(mat.mDefaultLocalName); if (mat.getSolid(0) != null) fluidColors.putIfAbsent( mat.getSolid(0) .getFluidID(), @@ -42,90 +39,80 @@ public static void makeColors() { .values() .stream() .filter(Objects::nonNull) - .forEach(fluid -> { - // progressBar.step(fluid.getName()); - fluidColors.putIfAbsent(fluid.getID(), convertColorInt(fluid.getColor())); - }); - // ProgressManager.pop(progressBar); + .forEach(fluid -> { fluidColors.putIfAbsent(fluid.getID(), convertColorInt(fluid.getColor())); }); } private static void reFillFluidColors() { - try { - // Should probably be put somewhere else, but I suck at Java - fluidColors.put(Materials.NatruralGas.mGas.getID(), new short[] { 0x00, 0xff, 0xff }); - fluidColors.put(Materials.OilLight.mFluid.getID(), new short[] { 0xff, 0xff, 0x00 }); - fluidColors.put(Materials.OilMedium.mFluid.getID(), new short[] { 0x00, 0xFF, 0x00 }); - fluidColors.put(Materials.OilHeavy.mFluid.getID(), new short[] { 0xFF, 0x00, 0xFF }); - fluidColors.put(Materials.Oil.mFluid.getID(), new short[] { 0x00, 0x00, 0x00 }); - fluidColors.put(Materials.Helium_3.mGas.getID(), new short[] { 0x80, 0x20, 0xe0 }); - fluidColors.put(Materials.SaltWater.mFluid.getID(), new short[] { 0x80, 0xff, 0x80 }); - // fluidColors.put(Materials.Naquadah.getMolten(0).getFluid().getID(), new short[]{0x20, 0x20, 0x20}); - // fluidColors.put(Materials.NaquadahEnriched.getMolten(0).getFluid().getID(), new short[]{0x60, 0x60, - // 0x60}); - fluidColors.put( - Materials.Lead.getMolten(0) - .getFluid() - .getID(), - new short[] { 0xd0, 0xd0, 0xd0 }); - fluidColors.put(Materials.Chlorobenzene.mFluid.getID(), new short[] { 0x40, 0x80, 0x40 }); - fluidColors.put( - FluidRegistry.getFluid("liquid_extra_heavy_oil") - .getID(), - new short[] { 0x00, 0x00, 0x50 }); - fluidColors.put(Materials.Oxygen.mGas.getID(), new short[] { 0x40, 0x40, 0xA0 }); - fluidColors.put(Materials.Nitrogen.mGas.getID(), new short[] { 0x00, 0x80, 0xd0 }); - fluidColors.put(Materials.Methane.mGas.getID(), new short[] { 0x80, 0x20, 0x20 }); - fluidColors.put(Materials.Ethane.mGas.getID(), new short[] { 0x40, 0x80, 0x20 }); - fluidColors.put(Materials.Ethylene.mGas.getID(), new short[] { 0xd0, 0xd0, 0xd0 }); - fluidColors.put(FluidRegistry.LAVA.getID(), new short[] { 0xFF, 0x00, 0x00 }); + + // Should probably be put somewhere else, but I suck at Java + fluidColors.put(Materials.NatruralGas.mGas.getID(), new short[] { 0x00, 0xff, 0xff }); + fluidColors.put(Materials.OilLight.mFluid.getID(), new short[] { 0xff, 0xff, 0x00 }); + fluidColors.put(Materials.OilMedium.mFluid.getID(), new short[] { 0x00, 0xFF, 0x00 }); + fluidColors.put(Materials.OilHeavy.mFluid.getID(), new short[] { 0xFF, 0x00, 0xFF }); + fluidColors.put(Materials.Oil.mFluid.getID(), new short[] { 0x00, 0x00, 0x00 }); + fluidColors.put(Materials.Helium_3.mGas.getID(), new short[] { 0x80, 0x20, 0xe0 }); + fluidColors.put(Materials.SaltWater.mFluid.getID(), new short[] { 0x80, 0xff, 0x80 }); + fluidColors.put( + Materials.Lead.getMolten(0) + .getFluid() + .getID(), + new short[] { 0xd0, 0xd0, 0xd0 }); + fluidColors.put(Materials.Chlorobenzene.mFluid.getID(), new short[] { 0x40, 0x80, 0x40 }); + fluidColors.put( + FluidRegistry.getFluid("liquid_extra_heavy_oil") + .getID(), + new short[] { 0x00, 0x00, 0x50 }); + fluidColors.put(Materials.Oxygen.mGas.getID(), new short[] { 0x40, 0x40, 0xA0 }); + fluidColors.put(Materials.Nitrogen.mGas.getID(), new short[] { 0x00, 0x80, 0xd0 }); + fluidColors.put(Materials.Methane.mGas.getID(), new short[] { 0x80, 0x20, 0x20 }); + fluidColors.put(Materials.Ethane.mGas.getID(), new short[] { 0x40, 0x80, 0x20 }); + fluidColors.put(Materials.Ethylene.mGas.getID(), new short[] { 0xd0, 0xd0, 0xd0 }); + fluidColors.put(FluidRegistry.LAVA.getID(), new short[] { 0xFF, 0x00, 0x00 }); + Fluid unknownWater = FluidRegistry.getFluid("unknowwater"); + if (unknownWater != null) { fluidColors.put( FluidRegistry.getFluid("unknowwater") .getID(), new short[] { 0x8A, 0x2B, 0xE2 }); - fluidColors.put(Materials.Hydrogen.mGas.getID(), new short[] { 0x32, 0x32, 0xD6 }); - fluidColors.put(Materials.SulfuricAcid.mFluid.getID(), new short[] { 0xFF, 0xB9, 0x0F }); - fluidColors.put(Materials.HydricSulfide.mFluid.getID(), new short[] { 0xFF, 0x8F, 0x43 }); - fluidColors.put(Materials.CarbonMonoxide.mGas.getID(), new short[] { 0x10, 0x4E, 0x8B }); - fluidColors.put(Materials.CarbonDioxide.mGas.getID(), new short[] { 0x69, 0x69, 0x69 }); - fluidColors.put( - FluidRegistry.getFluid("ic2distilledwater") - .getID(), - new short[] { 0x1E, 0x90, 0xFF }); - fluidColors.put(Materials.Deuterium.mGas.getID(), new short[] { 0xFF, 0xE3, 0x9F }); - fluidColors.put( - Materials.Iron.getMolten(0) - .getFluid() - .getID(), - new short[] { 0x8B, 0x88, 0x78 }); - fluidColors.put( - Materials.Tin.getMolten(0) - .getFluid() - .getID(), - new short[] { 0xE7, 0xE7, 0xE4 }); - fluidColors.put( - Materials.Copper.getMolten(0) - .getFluid() - .getID(), - new short[] { 0xFF, 0x7F, 0x24 }); - fluidColors.put( - FluidRegistry.getFluid("fluorine") - .getID(), - new short[] { 0x99, 0xC1, 0xAD }); - fluidColors.put( - FluidRegistry.getFluid("hydrofluoricacid") - .getID(), - new short[] { 0x00, 0xCE, 0xD1 }); - fluidColors.put(Materials.PhosphoricAcid.mFluid.getID(), new short[] { 0xEE, 0x76, 0x00 }); + } + fluidColors.put(Materials.Hydrogen.mGas.getID(), new short[] { 0x32, 0x32, 0xD6 }); + fluidColors.put(Materials.SulfuricAcid.mFluid.getID(), new short[] { 0xFF, 0xB9, 0x0F }); + fluidColors.put(Materials.HydricSulfide.mGas.getID(), new short[] { 0xFF, 0x8F, 0x43 }); + fluidColors.put(Materials.CarbonMonoxide.mGas.getID(), new short[] { 0x10, 0x4E, 0x8B }); + fluidColors.put(Materials.CarbonDioxide.mGas.getID(), new short[] { 0x69, 0x69, 0x69 }); + fluidColors.put( + FluidRegistry.getFluid("ic2distilledwater") + .getID(), + new short[] { 0x1E, 0x90, 0xFF }); + fluidColors.put(Materials.Deuterium.mGas.getID(), new short[] { 0xFF, 0xE3, 0x9F }); + fluidColors.put( + Materials.Iron.getMolten(0) + .getFluid() + .getID(), + new short[] { 0x8B, 0x88, 0x78 }); + fluidColors.put( + Materials.Tin.getMolten(0) + .getFluid() + .getID(), + new short[] { 0xE7, 0xE7, 0xE4 }); + fluidColors.put( + Materials.Copper.getMolten(0) + .getFluid() + .getID(), + new short[] { 0xFF, 0x7F, 0x24 }); + fluidColors.put( + FluidRegistry.getFluid("fluorine") + .getID(), + new short[] { 0x99, 0xC1, 0xAD }); + fluidColors.put( + FluidRegistry.getFluid("hydrofluoricacid") + .getID(), + new short[] { 0x00, 0xCE, 0xD1 }); + fluidColors.put(Materials.PhosphoricAcid.mFluid.getID(), new short[] { 0xEE, 0x76, 0x00 }); + + // possible nulls + fluidColors.put(Materials.LiquidAir.mFluid.getID(), new short[] { 0x99, 0x99, 0xEA }); - // possible nulls - fluidColors.put(Materials.LiquidAir.mFluid.getID(), new short[] { 0x99, 0x99, 0xEA }); - } catch (Exception ignored) {} - /* - * Set set = fluidColors.entrySet(); Iterator iterator = set.iterator(); System.out.println( - * "DETRAV SCANNER DEBUG" ); while(iterator.hasNext()) { Map.Entry mentry = (Map.Entry) iterator.next(); - * System.out.println( "key is: "+ (Integer)mentry.getKey() + " & Value is: " + ((short[])mentry.getValue())[0] - * + " " + ((short[])mentry.getValue())[1] + " " + ((short[])mentry.getValue())[2] ); } - */ } private static short[] convertColorInt(int color) {