diff --git a/assets/hbm/textures/models/sat_scanner.png b/assets/hbm/textures/models/sat_scanner.png index d98044a3e..d76b09571 100644 Binary files a/assets/hbm/textures/models/sat_scanner.png and b/assets/hbm/textures/models/sat_scanner.png differ diff --git a/com/hbm/inventory/gui/GUIAMSBase.java b/com/hbm/inventory/gui/GUIAMSBase.java index 4f5ff210e..ab87a8764 100644 --- a/com/hbm/inventory/gui/GUIAMSBase.java +++ b/com/hbm/inventory/gui/GUIAMSBase.java @@ -4,11 +4,8 @@ import org.lwjgl.opengl.GL11; import com.hbm.inventory.FluidTank; import com.hbm.inventory.container.ContainerAMSBase; -import com.hbm.inventory.container.ContainerMachinePumpjack; import com.hbm.lib.RefStrings; import com.hbm.tileentity.machine.TileEntityAMSBase; -import com.hbm.tileentity.machine.TileEntityMachinePumpjack; - import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; @@ -35,10 +32,10 @@ public class GUIAMSBase extends GuiInfoContainer { base.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 70 - 52, 16, 52); base.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 124 - 52, 16, 52); base.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 124 - 52, 16, 52); - this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 124 - 104, 7, 104, base.power, base.maxPower); + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 124 - 104, 7, 104, base.power, TileEntityAMSBase.maxPower); this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 44, guiTop + 124 - 106, 7, 106, new String[] { "Restriction Field:", base.field + "%" }); this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 53, guiTop + 124 - 106, 7, 106, new String[] { "Efficiency:", base.efficiency + "%" }); - this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 125, guiTop + 124 - 106, 7, 106, new String[] { "Heat:", base.heat + "/" + base.maxHeat }); + this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 125, guiTop + 124 - 106, 7, 106, new String[] { "Heat:", base.heat + "/" + TileEntityAMSBase.maxHeat }); } @Override diff --git a/com/hbm/inventory/gui/GUIScreenSatInterface.java b/com/hbm/inventory/gui/GUIScreenSatInterface.java index a534ff0c3..91a8aa992 100644 --- a/com/hbm/inventory/gui/GUIScreenSatInterface.java +++ b/com/hbm/inventory/gui/GUIScreenSatInterface.java @@ -6,8 +6,11 @@ import java.util.List; import org.lwjgl.opengl.GL11; +import com.hbm.entity.missile.EntityMissileBase; +import com.hbm.entity.missile.EntityMissileBaseAdvanced; import com.hbm.handler.FluidTypeHandler.FluidType; import com.hbm.inventory.MachineRecipes; +import com.hbm.inventory.gui.GUIScreenTemplateFolder.FolderButton; import com.hbm.items.ModItems; import com.hbm.items.tool.ItemAssemblyTemplate.EnumAssemblyTemplate; import com.hbm.items.tool.ItemCassette; @@ -16,9 +19,12 @@ 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.main.MainRegistry; import com.hbm.packet.ItemFolderPacket; import com.hbm.packet.PacketDispatcher; +import com.hbm.packet.SatLaserPacket; import com.hbm.saveddata.SatelliteSaveStructure; +import com.hbm.saveddata.SatelliteSaveStructure.SatelliteType; import com.hbm.saveddata.SatelliteSavedData; import net.minecraft.client.Minecraft; @@ -27,11 +33,14 @@ 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.Entity; +import net.minecraft.entity.monster.EntityMob; 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.AxisAlignedBB; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; @@ -54,6 +63,21 @@ public class GUIScreenSatInterface extends GuiScreen { public void updateScreen() { } + + protected void mouseClicked(int i, int j, int k) { + + if(connectedSat != null && connectedSat.satelliteType == SatelliteType.LASER) { + + if(i >= this.guiLeft + 8 && i < this.guiLeft + 208 && j >= this.guiTop + 8 && j < this.guiTop + 208 && player != null) { + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBleep"), 1.0F)); + + + int x = (int)player.posX - guiLeft + i - 8 - 100; + int z = (int)player.posZ - guiTop + j - 8 - 100; + PacketDispatcher.wrapper.sendToServer(new SatLaserPacket(x, z, connectedSat.satelliteID)); + } + } + } public void drawScreen(int mouseX, int mouseY, float f) { @@ -80,6 +104,16 @@ public class GUIScreenSatInterface extends GuiScreen { protected void drawGuiContainerForegroundLayer(int i, int j) { + if(connectedSat != null && connectedSat.satelliteType == SatelliteType.LASER) { + + + if(i >= this.guiLeft + 8 && i < this.guiLeft + 208 && j >= this.guiTop + 8 && j < this.guiTop + 208 && player != null) { + + int x = (int)player.posX - guiLeft + i - 8 - 100; + int z = (int)player.posZ - guiTop + j - 8 - 100; + func_146283_a(Arrays.asList(new String[] { x + " / " + z }), i, j); + } + } } protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { @@ -95,7 +129,7 @@ public class GUIScreenSatInterface extends GuiScreen { switch(connectedSat.satelliteType) { case LASER: - break; + drawMap(); break; case MAPPER: drawMap(); break; @@ -232,6 +266,34 @@ public class GUIScreenSatInterface extends GuiScreen { private void drawRadar() { + List entities = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(player.posX - 100, 0, player.posZ - 100, player.posX + 100, 5000, player.posZ + 100)); + + if(!entities.isEmpty()) { + for(Entity e : entities) { + + if(e.width * e.width * e.height >= 0.5D) { + int x = (int)((e.posX - player.posX) / ((double)100 * 2 + 1) * (200D - 8D)) - 4; + int z = (int)((e.posZ - player.posZ) / ((double)100 * 2 + 1) * (200D - 8D)) - 4 - 9; + + int t = 5; + + if(e instanceof EntityMissileBaseAdvanced) { + t = ((EntityMissileBaseAdvanced)e).getMissileType(); + } + + if(e instanceof EntityMob) { + t = 6; + } + + if(e instanceof EntityPlayer) { + t = 7; + } + + drawTexturedModalRect(guiLeft + 108 + x, guiTop + 117 + z, 216, 8 * t, 8, 8); + } + } + } + } private void prontMap() { diff --git a/com/hbm/main/CraftingManager.java b/com/hbm/main/CraftingManager.java index 00a726d02..3ba0826d4 100644 --- a/com/hbm/main/CraftingManager.java +++ b/com/hbm/main/CraftingManager.java @@ -1156,7 +1156,7 @@ public class CraftingManager { GameRegistry.addRecipe(new ItemStack(ModItems.ams_core_sing, 1), new Object[] { "EAE", "ASA", "EAE", 'E', ModItems.plate_euphemium, 'A', ModItems.cell_anti_schrabidium, 'S', ModItems.singularity }); GameRegistry.addRecipe(new ItemStack(ModItems.ams_core_wormhole, 1), new Object[] { "DPD", "PSP", "DPD", 'D', ModItems.plate_dineutronium, 'P', ModItems.powder_spark_mix, 'S', ModItems.singularity }); GameRegistry.addRecipe(new ItemStack(ModItems.ams_core_eyeofharmony, 1), new Object[] { "ALA", "LSL", "ALA", 'A', ModItems.plate_dalekanium, 'L', new ItemStack(ModItems.fluid_barrel_full, 1, FluidType.LAVA.getID()), 'S', ModItems.black_hole }); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ams_core_thingy), new Object[] { "NSN", "NGN", "N N", 'N', "nuggetGold", 'G', "ingotGold", 'S', ModItems.battery_spark_cell_10000 })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.ams_core_thingy), new Object[] { "NSN", "NGN", "G G", 'N', "nuggetGold", 'G', "ingotGold", 'S', ModItems.battery_spark_cell_10000 })); GameRegistry.addShapelessRecipe(new ItemStack(Items.paper, 1), new Object[] { new ItemStack(ModItems.assembly_template, 1, OreDictionary.WILDCARD_VALUE) }); GameRegistry.addShapelessRecipe(new ItemStack(Items.paper, 1), new Object[] { new ItemStack(ModItems.chemistry_template, 1, OreDictionary.WILDCARD_VALUE) }); diff --git a/com/hbm/packet/PacketDispatcher.java b/com/hbm/packet/PacketDispatcher.java index 549a59371..ac4e5f998 100644 --- a/com/hbm/packet/PacketDispatcher.java +++ b/com/hbm/packet/PacketDispatcher.java @@ -55,12 +55,14 @@ public class PacketDispatcher { wrapper.registerMessage(AuxGaugePacket.Handler.class, AuxGaugePacket.class, i++, Side.CLIENT); //Siren packet for looped sounds wrapper.registerMessage(TESirenPacket.Handler.class, TESirenPacket.class, i++, Side.CLIENT); - //Signals server to change ItemStack's + //Signals server to change ItemStacks wrapper.registerMessage(ItemDesignatorPacket.Handler.class, ItemDesignatorPacket.class, i++, Side.SERVER); //Siren packet for looped sounds wrapper.registerMessage(TERadarPacket.Handler.class, TERadarPacket.class, i++, Side.CLIENT); //Siren packet for looped sounds wrapper.registerMessage(TERadarDestructorPacket.Handler.class, TERadarDestructorPacket.class, i++, Side.CLIENT); + //Signals server to perform orbital strike + wrapper.registerMessage(SatLaserPacket.Handler.class, SatLaserPacket.class, i++, Side.SERVER); } } diff --git a/com/hbm/packet/SatLaserPacket.java b/com/hbm/packet/SatLaserPacket.java new file mode 100644 index 000000000..a3cd4d30c --- /dev/null +++ b/com/hbm/packet/SatLaserPacket.java @@ -0,0 +1,80 @@ +package com.hbm.packet; + +import com.hbm.explosion.ExplosionLarge; +import com.hbm.items.ModItems; +import com.hbm.saveddata.SatelliteSaveStructure; +import com.hbm.saveddata.SatelliteSavedData; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class SatLaserPacket implements IMessage { + + //0: Add + //1: Subtract + //2: Set + int x; + int z; + int freq; + + public SatLaserPacket() + { + + } + + public SatLaserPacket(int x, int z, int freq) + { + this.x = x; + this.z = z; + this.freq = freq; + } + + @Override + public void fromBytes(ByteBuf buf) { + x = buf.readInt(); + z = buf.readInt(); + freq = buf.readInt(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(x); + buf.writeInt(z); + buf.writeInt(freq); + } + + public static class Handler implements IMessageHandler { + + @Override + public IMessage onMessage(SatLaserPacket m, MessageContext ctx) { + + EntityPlayer p = ctx.getServerHandler().playerEntity; + + SatelliteSavedData data = (SatelliteSavedData)p.worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites"); + if(data == null) { + p.worldObj.perWorldStorage.setData("satellites", new SatelliteSavedData(p.worldObj)); + + data = (SatelliteSavedData)p.worldObj.perWorldStorage.loadData(SatelliteSavedData.class, "satellites"); + } + + SatelliteSaveStructure sat = data.getSatFromFreq(m.freq); + + if(sat != null) { + if(sat.lastOp + 10000 < System.currentTimeMillis()) { + sat.lastOp = System.currentTimeMillis(); + + int y = p.worldObj.getHeightValue(m.x, m.z); + + ExplosionLarge.explodeFire(p.worldObj, m.x, y, m.z, 50, true, true, true); + } + } + + return null; + } + } +} diff --git a/com/hbm/saveddata/SatelliteSaveStructure.java b/com/hbm/saveddata/SatelliteSaveStructure.java index 8a8460f30..705fd5642 100644 --- a/com/hbm/saveddata/SatelliteSaveStructure.java +++ b/com/hbm/saveddata/SatelliteSaveStructure.java @@ -11,6 +11,7 @@ public class SatelliteSaveStructure { public int satelliteID; public int satDim; public SatelliteType satelliteType; + public long lastOp; public SatelliteSaveStructure() { } @@ -51,12 +52,14 @@ public class SatelliteSaveStructure { satelliteID = nbt.getInteger("sat_" + index + "_id"); satelliteType = SatelliteType.getEnum(nbt.getInteger("sat_" + index + "_type")); satDim = nbt.getInteger("sat_" + index + "_dim"); + lastOp = nbt.getLong("sat_" + index + "_op"); } public void writeToNBT(NBTTagCompound nbt, int index) { nbt.setInteger("sat_" + index + "_id", satelliteID); nbt.setInteger("sat_" + index + "_type", satelliteType.getID()); nbt.setInteger("sat_" + index + "_dim", satDim); + nbt.setLong("sat_" + index + "_op", lastOp); } }