From abbe0adf0bb687869d8870377a37343241a1040b Mon Sep 17 00:00:00 2001 From: HbmMods Date: Sat, 5 May 2018 19:00:57 +0200 Subject: [PATCH] Mapper and scanner functionality, sat textures, bugfixes --- assets/hbm/textures/gui/gui_sat_interface.png | Bin 2265 -> 2616 bytes assets/hbm/textures/items/sat_foeq.png | Bin 190 -> 368 bytes assets/hbm/textures/items/sat_interface.png | Bin 0 -> 202 bytes assets/hbm/textures/items/sat_laser.png | Bin 176 -> 338 bytes assets/hbm/textures/items/sat_mapper.png | Bin 194 -> 332 bytes assets/hbm/textures/items/sat_radar.png | Bin 186 -> 349 bytes assets/hbm/textures/items/sat_resonator.png | Bin 195 -> 398 bytes assets/hbm/textures/items/sat_scanner.png | Bin 189 -> 367 bytes com/hbm/entity/missile/EntityCarrier.java | 2 + com/hbm/handler/GUIHandler.java | 2 + .../inventory/gui/GUIScreenSatInterface.java | 263 ++++++++++++++++++ com/hbm/items/ModItems.java | 4 + com/hbm/items/tool/ItemSatInterface.java | 34 +++ com/hbm/main/CraftingManager.java | 4 +- com/hbm/saveddata/SatelliteSavedData.java | 9 +- 15 files changed, 314 insertions(+), 4 deletions(-) create mode 100644 assets/hbm/textures/items/sat_interface.png create mode 100644 com/hbm/inventory/gui/GUIScreenSatInterface.java create mode 100644 com/hbm/items/tool/ItemSatInterface.java diff --git a/assets/hbm/textures/gui/gui_sat_interface.png b/assets/hbm/textures/gui/gui_sat_interface.png index b36b6745af969c55fd4f7766999458b5cbe01707..b3781407bc045a976e9053e6c8eec1ceb19ca2f0 100644 GIT binary patch literal 2616 zcmcguSyYo*626Hs1OYct0Z~8)5mCVnmuU#HIm879L1ax7!3BO15z>$i6wNdOZlJV) zpfsRF5@bmlHH%w77C|Kh2qCyY5R73o~m14Reg2txxe@x z*kd%$d>#P6$op>|egMF9CJdmEIu&~Mew0oj;@!OcQ92=_j{O4weYv;CZvUV2Wn%7S z3#pmjh-!(R_5DS#Yr8Txur@uj`p}n+>37rEnuMAnHsV?H=<{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ac16e9e668ccdd6316e17548054b00a..a19fa995e1c3f2d2af8b0b3a9e0338fe36e13380 100644 GIT binary patch delta 326 zcmV-M0lEIZ0q_ElGk*amNkl1t|r#J{gi9;s0NY^NZjM7b9?+;}0 zR~!zm-TV#dC~o3yPIbLGQ-+j4KtehRpNk2xX_^kc<9+Y@-1~7H{FkEpcNz0+Hk;P- z{d^|?6M%4$NSUukA$45?kmtFaJiI!8hT$TStD7eogQRIXJbxd8#BnV1`CPQt(m)15 zyAWfHSZk$$?D{9W2cK`sIX%0i%-0xW#Pd9?wJ4>S&1Ss|o!-f>y5Z?`N>LOjrF#Be zgJ$Pr!h0J8K_CE86rq%&C<-2zDd!j0e7xKaHU>azEkO{7@B8AquEcRHaQKOxZg{m? zQB@THWm&S_Za>?3xJab_>Njz^wX3S?1-se@X^p<`3qY1-2lpIm0)XqfqaUh)9OFAm YKV6Ekm<0O@=l}o!07*qoM6N<$f{E(<9 zz_5d=o=R*^Qgd1=NxHc;7n0bszJI3}6M%@=!GFx&i>U-2Gs2x@q=^-S!d(JAg|`U` zxU5nTfzM;^SBSi_Zk-vnBDZh}i%BH}zMbRs05PIs#>v9{$qWDh002ovPDHLkV1nQ) BL4E)L diff --git a/assets/hbm/textures/items/sat_interface.png b/assets/hbm/textures/items/sat_interface.png new file mode 100644 index 0000000000000000000000000000000000000000..ef9ce903ac65e3901d124d0ce97fa176d4032762 GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vfe60stxH z*j)fXR@C(U^*SrzoRhVdNhxWyUXL>NSICN*eufX6o?YR2b$`cv@GuMj0BbFC1U|_e zJQ4ULK6tBOQ*v|p31bYpuGN-3mi>V0S;*o31f zLf`jzc|Z5A*b!*0C$LhA1t%Bq{S!yfwk^uCbYK8@d-O}jsR|(|2m*v*h$Kl+Rn=ZA ub|Qq>c@J4p(;@Quf%dtbS;@ih|NH_rp0000#*D4~D17nu zs{kMkkzSlTEChi^8e*7*Y{TQJH{{?lw|God(#why{1(!ewS%d~01K0n7rBGk*aCNkl|(`lofY`37TBtb}Fy>=mwO^R@*TXxRb8D41Wbd5cGLk>;BFi3T%}K zAq+s*bu)NY!L*W_t8bK2v~7#l+R9l40993)IF6B04kfevlQmc=MVhA6bxm28*2mm6 zI1EFYrs3`Ld~w7hL7wL`ILp>YJQ8TFky4IeSl^SruOvx~=XvS~1Gk*YiNkl;i zV+>_kT1k)XoGhMQ;pOqpZh~{Z^DA%rv3o1ctHa?<{Q;C0k71NDol^h+002ovPDHLk FV1hcvk-7i? delta 143 zcmV;A0C4}^0=fZ^Gk*YaNklt<800>D%PDHLkV1gb-KGpyL diff --git a/assets/hbm/textures/items/sat_resonator.png b/assets/hbm/textures/items/sat_resonator.png index 52df31931c9c38ba0c657bb749c0abe32d0e9747..304f8478fa8dbf2bbebcf420d89f340dda36d8f4 100644 GIT binary patch delta 356 zcmV-q0h|8A0geNZGk*a^NklA$O&47h~Sa51V0!Qei3DOP@#f+}O zB~$*D?#@mw;@Y)DaA=lxE4K;FS`sL9sLKu4NvX|;Q2LvWd-*;0e%uTHrQ1oYt783r zzYr5bXaECXFkb1e&o`_Km#2q2qYNU1(7x}Zlwz~lAf+?_8h-#UkAY#HU-9w&T$zdQ z`=n{gZntAJ8XfK%`$HWh3`4Dy!m=!~EJG<(1XMx7Fw_8X9Mfzz>2|v$NpkR%*1PY? z&2@^Dl046GT^E4ma%liKj-&T|DAjts)>29xMUfs3hk81lmiFeX%G~L6kW%7#9$A*L zSS(6kYt)(B?Oir`o|C*@R!-*#5JgeJ90c_vJ_2mFTV}J_ks0boe5lK|ZEcz+tyYU( zug82oFVuYU$J(}Cxeq@f!n@aXyK_>5@#^p9-}(kk9Ict`oTrum00001H%E3Gk*YjNkl?^CMv;kv)MSr zU2};tFgi_ZCp-_r+sZw;5uCDz9 z`73wt+&|FORqUpVZW6i_%v2Bxf`d!B5T{<6G#5YcosvVIhvb|9|COtodu7(rG+ouq zYycoD8ukA6WR=)r6=y}G;)|^^CFbEcjn)VQ5Om$sHmI7@v z-{kY-6~`y%c(}bLGw3)DOxP+|N-obNgb;9D7sD`Mx7$HVX=PSv+g1r76z5#!d9DC} zQmQDW_8ypU7={o+pe#!yNdf?nQW7a8VT|oXE5Q;Df&k+<;_-!QjqUrM%umq-obwf2 zmiFmbpV0R`sy?dHVBqkGfyES}C{mv1!S{VI#!%Pwk4CH|ilT47@}VF5t7Jvv(-!i*55RNY(;j3#8mW@#@S01E&B07*qoM6N<$f=kan AiU0rr diff --git a/com/hbm/entity/missile/EntityCarrier.java b/com/hbm/entity/missile/EntityCarrier.java index 166b79994..b29a91798 100644 --- a/com/hbm/entity/missile/EntityCarrier.java +++ b/com/hbm/entity/missile/EntityCarrier.java @@ -125,6 +125,8 @@ public class EntityCarrier extends EntityThrowable { SatelliteSavedData data = (SatelliteSavedData)worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites"); if(data == null) { worldObj.perWorldStorage.setData("satellites", new SatelliteSavedData(worldObj)); + + data = (SatelliteSavedData)worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites"); } int freq = ItemSatChip.getFreq(payload); diff --git a/com/hbm/handler/GUIHandler.java b/com/hbm/handler/GUIHandler.java index d50379ec8..fcca6f030 100644 --- a/com/hbm/handler/GUIHandler.java +++ b/com/hbm/handler/GUIHandler.java @@ -1235,6 +1235,8 @@ public class GUIHandler implements IGuiHandler { return new GUIScreenTemplateFolder(player); case ModItems.guiID_item_designator: return new GUIScreenDesignator(player); + case ModItems.guiID_item_sat_interface: + return new GUIScreenSatInterface(player); } } return null; diff --git a/com/hbm/inventory/gui/GUIScreenSatInterface.java b/com/hbm/inventory/gui/GUIScreenSatInterface.java new file mode 100644 index 000000000..30837eb46 --- /dev/null +++ b/com/hbm/inventory/gui/GUIScreenSatInterface.java @@ -0,0 +1,263 @@ +package com.hbm.inventory.gui; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.lwjgl.opengl.GL11; + +import com.hbm.handler.FluidTypeHandler.FluidType; +import com.hbm.inventory.MachineRecipes; +import com.hbm.items.ModItems; +import com.hbm.items.tool.ItemAssemblyTemplate.EnumAssemblyTemplate; +import com.hbm.items.tool.ItemCassette; +import com.hbm.items.tool.ItemCassette.TrackType; +import com.hbm.items.tool.ItemChemistryTemplate; +import com.hbm.items.tool.ItemFluidIdentifier; +import com.hbm.items.tool.ItemSatChip; +import com.hbm.lib.RefStrings; +import com.hbm.packet.ItemFolderPacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.saveddata.SatelliteSaveStructure; +import com.hbm.saveddata.SatelliteSavedData; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; + +public class GUIScreenSatInterface extends GuiScreen { + + protected static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_sat_interface.png"); + protected int xSize = 216; + protected int ySize = 216; + protected int guiLeft; + protected int guiTop; + private final EntityPlayer player; + protected SatelliteSaveStructure connectedSat; + public static SatelliteSavedData satData; + + public GUIScreenSatInterface(EntityPlayer player) { + + this.player = player; + } + + public void updateScreen() { + } + + public void drawScreen(int mouseX, int mouseY, float f) + { + this.drawDefaultBackground(); + this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); + GL11.glDisable(GL11.GL_LIGHTING); + this.drawGuiContainerForegroundLayer(mouseX, mouseY); + GL11.glEnable(GL11.GL_LIGHTING); + } + + public void initGui() + { + super.initGui(); + this.guiLeft = (this.width - this.xSize) / 2; + this.guiTop = (this.height - this.ySize) / 2; + + if(satData != null && player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.sat_interface) { + + int freq = ItemSatChip.getFreq(player.getHeldItem()); + + connectedSat = satData.getSatFromFreq(freq); + } + } + + protected void drawGuiContainerForegroundLayer(int i, int j) { + + } + + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + + if(connectedSat == null) { + drawNotConnected(); + } else { + switch(connectedSat.satelliteType) { + + case LASER: + break; + + case MAPPER: + drawMap(); break; + + case RADAR: + drawRadar(); break; + + case SCANNER: + drawScan(); break; + + case RELAY: + case RESONATOR: + drawNoService(); break; + } + } + } + + private int scanPos = 0; + private long lastMilli = 0; + + private void progresScan() { + + if(lastMilli + 25 < System.currentTimeMillis()) { + lastMilli = System.currentTimeMillis(); + scanPos++; + } + + if(scanPos >= 200) + scanPos -= 200; + } + + private int[][] map = new int[200][200]; + + private void drawMap() { + + World world = player.worldObj; + + for(int i = -100; i < 100; i++) { + int x = (int)player.posX + i; + int z = (int)player.posZ + scanPos - 100; + int y = world.getHeightValue(x, z) - 1; + map[i + 100][scanPos] = world.getBlock(x, y, z).getMaterial().getMaterialMapColor().func_151643_b(2); + } + prontMap(); + progresScan(); + } + + private void drawScan() { + + World world = player.worldObj; + + for(int i = -100; i < 100; i++) { + int x = (int)player.posX + i; + int z = (int)player.posZ + scanPos - 100; + //int y = world.getHeightValue(x, z) - 1; + //map[i + 100][scanPos] = 0x081F0D + world.getBlock(x, y, z).getMaterial().getMaterialMapColor().func_151643_b(3); + + for(int j = 255; j >= 0; j--) { + int c = getColorFromBlock(new ItemStack(world.getBlock(x, j, z), 1, world.getBlockMetadata(x, j, z))); + + if(c != 0) { + map[i + 100][scanPos] = c; + break; + } + } + } + prontMap(); + progresScan(); + } + + private int getColorFromBlock(ItemStack stack) { + + if(stack == null || stack.getItem() == null/* || stack.getItemDamage() < 0*/) + return 0; + + if(MachineRecipes.mODE(stack, "oreCoal")) + return 0x333333; + if(MachineRecipes.mODE(stack, "oreIron")) + return 0xb2aa92; + if(MachineRecipes.mODE(stack, "oreGold")) + return 0xffe460; + if(MachineRecipes.mODE(stack, "oreSilver")) + return 0xe5e5e5; + if(MachineRecipes.mODE(stack, "oreDiamond")) + return 0x6ed5ef; + if(MachineRecipes.mODE(stack, "oreEmerald")) + return 0x6cf756; + if(MachineRecipes.mODE(stack, "oreLapis")) + return 0x092f7a; + if(MachineRecipes.mODE(stack, "oreRedstone")) + return 0xe50000; + if(MachineRecipes.mODE(stack, "oreTin")) + return 0xa09797; + if(MachineRecipes.mODE(stack, "oreCopper")) + return 0xd16208; + if(MachineRecipes.mODE(stack, "oreLead")) + return 0x384b68; + if(MachineRecipes.mODE(stack, "oreAluminum")) + return 0xdbdbdb; + if(MachineRecipes.mODE(stack, "oreTungsten")) + return 0x333333; + if(MachineRecipes.mODE(stack, "oreUranium")) + return 0x3e4f3c; + if(MachineRecipes.mODE(stack, "oreBeryllium")) + return 0x8e8d7d; + if(MachineRecipes.mODE(stack, "oreSulfur")) + return 0x9b9309; + if(MachineRecipes.mODE(stack, "oreSalpeter")) + return 0xa5a09d; + if(MachineRecipes.mODE(stack, "oreFluorite")) + return 0xffffff; + if(MachineRecipes.mODE(stack, "oreSchrabidium")) + return 0x1cffff; + + return isOre(stack) ? 0xBA00AF : 0x000000; + } + + private static boolean isOre(ItemStack stack) { + + int[] ids = OreDictionary.getOreIDs(new ItemStack(stack.getItem(), 1, stack.getItemDamage())); + + for(int i = 0; i < ids.length; i++) { + + String s = OreDictionary.getOreName(ids[i]); + + if(s.length() > 3 && s.substring(3).equals("ore")) + return true; + } + + return false; + } + + private void drawRadar() { + + } + + private void prontMap() { + for(int x = 0; x < 200; x++) { + for(int z = 0; z < 200; z++) { + if(map[x][z] != 0) { + GL11.glColor3ub((byte)((map[x][z] & 0xFF0000) >> 16), (byte)((map[x][z] & 0x00FF00) >> 8), (byte)(map[x][z] & 0x0000FF)); + drawTexturedModalRect(guiLeft + 8 + x, guiTop + 8 + z, 216, 216, 1, 1); + } + } + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + private void drawNoService() { + drawTexturedModalRect((this.width - 77) / 2, (this.height - 12) / 2, 0, 228, 77, 12); + } + + private void drawNotConnected() { + drawTexturedModalRect((this.width - 121) / 2, (this.height - 12) / 2, 0, 216, 121, 12); + } + + protected void keyTyped(char p_73869_1_, int p_73869_2_) + { + if (p_73869_2_ == 1 || p_73869_2_ == this.mc.gameSettings.keyBindInventory.getKeyCode()) + { + this.mc.thePlayer.closeScreen(); + } + + } + +} diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index 3f7924b7d..38b7a1202 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -684,6 +684,7 @@ public class ModItems { public static Item sat_foeq; public static Item sat_resonator; public static Item sat_chip; + public static Item sat_interface; public static Item gun_rpg; public static Item gun_rpg_ammo; @@ -1219,6 +1220,7 @@ public class ModItems { public static final int guiID_item_folder = 99; public static final int guiID_item_designator = 100; + public static final int guiID_item_sat_interface = 101; public static void initializeItem() { @@ -1833,6 +1835,7 @@ public class ModItems { sat_foeq = new ItemSatChip().setUnlocalizedName("sat_foeq").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":sat_foeq"); sat_resonator = new ItemSatChip().setUnlocalizedName("sat_resonator").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":sat_resonator"); sat_chip = new ItemSatChip().setUnlocalizedName("sat_chip").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":sat_chip"); + sat_interface = new ItemSatInterface().setUnlocalizedName("sat_interface").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":sat_interface"); gun_rpg = new GunRpg().setUnlocalizedName("gun_rpg").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_rpg_new"); gun_rpg_ammo = new Item().setUnlocalizedName("gun_rpg_ammo").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_rpg_ammo_new"); @@ -3158,6 +3161,7 @@ public class ModItems { GameRegistry.registerItem(sat_foeq, sat_foeq.getUnlocalizedName()); GameRegistry.registerItem(sat_resonator, sat_resonator.getUnlocalizedName()); GameRegistry.registerItem(sat_chip, sat_chip.getUnlocalizedName()); + GameRegistry.registerItem(sat_interface, sat_interface.getUnlocalizedName()); //Guns GameRegistry.registerItem(gun_revolver_iron, gun_revolver_iron.getUnlocalizedName()); diff --git a/com/hbm/items/tool/ItemSatInterface.java b/com/hbm/items/tool/ItemSatInterface.java new file mode 100644 index 000000000..c2eb6a78e --- /dev/null +++ b/com/hbm/items/tool/ItemSatInterface.java @@ -0,0 +1,34 @@ +package com.hbm.items.tool; + +import com.hbm.inventory.gui.GUIScreenSatInterface; +import com.hbm.items.ModItems; +import com.hbm.main.MainRegistry; +import com.hbm.saveddata.SatelliteSavedData; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class ItemSatInterface extends ItemSatChip { + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + + + if(world.isRemote) + player.openGui(MainRegistry.instance, ModItems.guiID_item_sat_interface, world, 0, 0, 0); + + return stack; + } + + public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean b) { + + if(!world.isRemote) { + SatelliteSavedData data = (SatelliteSavedData)entity.worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites"); + GUIScreenSatInterface.satData = data; + } + } + +} diff --git a/com/hbm/main/CraftingManager.java b/com/hbm/main/CraftingManager.java index bfd8926b9..00a726d02 100644 --- a/com/hbm/main/CraftingManager.java +++ b/com/hbm/main/CraftingManager.java @@ -893,8 +893,8 @@ public class CraftingManager { GameRegistry.addRecipe(new ShapedOreRecipe(ItemBattery.getEmptyBattery(ModItems.battery_advanced), new Object[] { " A ", "PLP", "PSP", 'A', ModItems.wire_red_copper, 'P', "plateCopper", 'S', "dustSulfur", 'L', "dustLead" })); GameRegistry.addRecipe(new ShapedOreRecipe(ItemBattery.getEmptyBattery(ModItems.battery_lithium), new Object[] { "A A", "PSP", "PLP", 'A', ModItems.wire_gold, 'P', "plateTitanium", 'S', "dustLithium", 'L', ModItems.powder_cobalt })); GameRegistry.addRecipe(new ShapedOreRecipe(ItemBattery.getEmptyBattery(ModItems.battery_lithium), new Object[] { "A A", "PLP", "PSP", 'A', ModItems.wire_gold, 'P', "plateTitanium", 'S', "dustLithium", 'L', ModItems.powder_cobalt })); - GameRegistry.addRecipe(new ShapedOreRecipe(ItemBattery.getEmptyBattery(ModItems.battery_schrabidium), new Object[] { " A ", "PNP", "PSP", 'A', ModItems.wire_schrabidium, 'P', "plateSchrabidium", 'S', "powderSchrabidium", 'N', ModItems.powder_neptunium })); - GameRegistry.addRecipe(new ShapedOreRecipe(ItemBattery.getEmptyBattery(ModItems.battery_schrabidium), new Object[] { " A ", "PSP", "PNP", 'A', ModItems.wire_schrabidium, 'P', "plateSchrabidium", 'S', "powderSchrabidium", 'N', ModItems.powder_neptunium })); + GameRegistry.addRecipe(new ShapedOreRecipe(ItemBattery.getEmptyBattery(ModItems.battery_schrabidium), new Object[] { " A ", "PNP", "PSP", 'A', ModItems.wire_schrabidium, 'P', "plateSchrabidium", 'S', "dustSchrabidium", 'N', ModItems.powder_neptunium })); + GameRegistry.addRecipe(new ShapedOreRecipe(ItemBattery.getEmptyBattery(ModItems.battery_schrabidium), new Object[] { " A ", "PSP", "PNP", 'A', ModItems.wire_schrabidium, 'P', "plateSchrabidium", 'S', "dustSchrabidium", 'N', ModItems.powder_neptunium })); GameRegistry.addRecipe(new ShapedOreRecipe(ItemBattery.getEmptyBattery(ModItems.battery_spark), new Object[] { " A ", "PSP", "PSP", 'A', ModItems.wire_magnetized_tungsten, 'P', "plateDineutronium", 'S', ModItems.powder_spark_mix })); GameRegistry.addRecipe(new ShapedOreRecipe(ItemBattery.getFullBattery(ModItems.energy_core), new Object[] { "PCW", "TRD", "PCW", 'P', ModItems.plate_advanced_alloy, 'C', ModItems.coil_advanced_alloy, 'W', ModItems.wire_advanced_alloy, 'R', ModItems.cell_tritium, 'D', ModItems.cell_deuterium, 'T', "ingotTungsten" })); GameRegistry.addRecipe(new ShapedOreRecipe(ItemBattery.getFullBattery(ModItems.energy_core), new Object[] { "PCW", "TDR", "PCW", 'P', ModItems.plate_advanced_alloy, 'C', ModItems.coil_advanced_alloy, 'W', ModItems.wire_advanced_alloy, 'R', ModItems.cell_tritium, 'D', ModItems.cell_deuterium, 'T', "ingotTungsten" })); diff --git a/com/hbm/saveddata/SatelliteSavedData.java b/com/hbm/saveddata/SatelliteSavedData.java index 56612c97a..562f1e2ce 100644 --- a/com/hbm/saveddata/SatelliteSavedData.java +++ b/com/hbm/saveddata/SatelliteSavedData.java @@ -28,11 +28,16 @@ public class SatelliteSavedData extends WorldSavedData { public boolean isFreqTaken(int freq) { + return getSatFromFreq(freq) != null; + } + + public SatelliteSaveStructure getSatFromFreq(int freq) { + for(SatelliteSaveStructure sat : satellites) if(sat.satelliteID == freq) - return true; + return sat; - return false; + return null; } @Override