mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Death ray and radar functionality, fixed thingy crafting recipe
This commit is contained in:
parent
3369c38495
commit
e903763d25
Binary file not shown.
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.4 KiB |
@ -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
|
||||
|
||||
@ -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<Entity> 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() {
|
||||
|
||||
@ -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) });
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
80
com/hbm/packet/SatLaserPacket.java
Normal file
80
com/hbm/packet/SatLaserPacket.java
Normal file
@ -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<SatLaserPacket, IMessage> {
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user