mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
we gotta move these color TVs
This commit is contained in:
parent
3473fa12e6
commit
022a93df9b
@ -21,6 +21,8 @@
|
||||
* The map will scan loaded chunks instantly, unloaded chunks have a limit of 5 chunk loads per tick to prevent excessive lag
|
||||
* The chunk load limit can be adjusted in the machine config file
|
||||
* The map will show terrain height between Y:50 and Y:128, anything outside that range is truncated
|
||||
* Radars now have a second GUI which allows the use of a battery, as well as linking the radar to other machines
|
||||
* By using the number keys, the radar can now launch missiles, ABMs or artillery at the current aimed at position
|
||||
* The turbofan's afterburner now adds a 33% efficiency bonus for every level. This means that instead of the efficiency remaining constant between levels, a tier 3 upgrade will yield double efficiency.
|
||||
* Reduced the flarestack's base energy efficiency
|
||||
* Trenchmaster armor is now unbreakable
|
||||
@ -31,6 +33,7 @@
|
||||
* Remodeled the anti-ballistic missile
|
||||
* Anti-ballistic missiles now use predictive targeting as well as a heightened sensor range of 1,000 blocks (instead of 500) which should make them a lot more effective
|
||||
* Anti-ballistic missiles accelerate 4x faster than normal missiles and have a 50% higher top-speed
|
||||
* Anti-ballistic missiles can now load their own chunks, allowing them to get to far away incoming missiles without getting stuck
|
||||
* PWRs that have recently been close to unloaded chunks now have a 40 tick timeframe where they are "frozen", only trying to connect to a fluid network but not doing any fission, this should reduce the amount of meltdowns caused by chunkloading
|
||||
|
||||
## Fixed
|
||||
|
||||
@ -15,31 +15,33 @@ public class RadarEntry {
|
||||
public int posY;
|
||||
public int posZ;
|
||||
public int dim;
|
||||
public int entityID;
|
||||
/** Whether this radar entry should be counted for the redstone output */
|
||||
public boolean redstone;
|
||||
|
||||
public RadarEntry() { } //blank ctor for packets
|
||||
|
||||
public RadarEntry(String name, int level, int x, int y, int z, int dim, boolean redstone) {
|
||||
public RadarEntry(String name, int level, int x, int y, int z, int dim, int entityID, boolean redstone) {
|
||||
this.unlocalizedName = name;
|
||||
this.blipLevel = level;
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;
|
||||
this.dim = dim;
|
||||
this.entityID = entityID;
|
||||
this.redstone = redstone;
|
||||
}
|
||||
|
||||
public RadarEntry(IRadarDetectableNT detectable, Entity entity, boolean redstone) {
|
||||
this(detectable.getUnlocalizedName(), detectable.getBlipLevel(), (int) Math.floor(entity.posX), (int) Math.floor(entity.posY), (int) Math.floor(entity.posZ), entity.dimension, redstone);
|
||||
this(detectable.getUnlocalizedName(), detectable.getBlipLevel(), (int) Math.floor(entity.posX), (int) Math.floor(entity.posY), (int) Math.floor(entity.posZ), entity.dimension, entity.getEntityId(), redstone);
|
||||
}
|
||||
|
||||
public RadarEntry(IRadarDetectable detectable, Entity entity) {
|
||||
this(detectable.getTargetType().name, detectable.getTargetType().ordinal(), (int) Math.floor(entity.posX), (int) Math.floor(entity.posY), (int) Math.floor(entity.posZ), entity.dimension, entity.motionY < 0);
|
||||
this(detectable.getTargetType().name, detectable.getTargetType().ordinal(), (int) Math.floor(entity.posX), (int) Math.floor(entity.posY), (int) Math.floor(entity.posZ), entity.dimension, entity.getEntityId(), entity.motionY < 0);
|
||||
}
|
||||
|
||||
public RadarEntry(EntityPlayer player) {
|
||||
this(player.getDisplayName(), IRadarDetectableNT.PLAYER, (int) Math.floor(player.posX), (int) Math.floor(player.posY), (int) Math.floor(player.posZ), player.dimension, true);
|
||||
this(player.getDisplayName(), IRadarDetectableNT.PLAYER, (int) Math.floor(player.posX), (int) Math.floor(player.posY), (int) Math.floor(player.posZ), player.dimension, player.getEntityId(), true);
|
||||
}
|
||||
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
@ -49,6 +51,7 @@ public class RadarEntry {
|
||||
this.posY = buf.readInt();
|
||||
this.posZ = buf.readInt();
|
||||
this.dim = buf.readShort();
|
||||
this.entityID = buf.readInt();
|
||||
}
|
||||
|
||||
public void toBytes(ByteBuf buf) {
|
||||
@ -58,5 +61,6 @@ public class RadarEntry {
|
||||
buf.writeInt(this.posY);
|
||||
buf.writeInt(this.posZ);
|
||||
buf.writeShort(this.dim);
|
||||
buf.writeInt(this.entityID);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1057,8 +1057,9 @@ public class ModBlocks {
|
||||
public static Block launch_table;
|
||||
|
||||
public static Block soyuz_launcher;
|
||||
|
||||
|
||||
public static Block machine_radar;
|
||||
public static Block radar_screen;
|
||||
|
||||
public static Block machine_turbofan;
|
||||
public static Block machine_turbinegas;
|
||||
@ -2164,6 +2165,7 @@ public class ModBlocks {
|
||||
|
||||
launch_pad = new LaunchPad(Material.iron).setBlockName("launch_pad").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":launch_pad");
|
||||
machine_radar = new MachineRadar(Material.iron).setBlockName("machine_radar").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_radar");
|
||||
radar_screen = new MachineRadarScreen(Material.iron).setBlockName("radar_screen").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
|
||||
machine_missile_assembly = new MachineMissileAssembly(Material.iron).setBlockName("machine_missile_assembly").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_missile_assembly");
|
||||
compact_launcher = new CompactLauncher(Material.iron).setBlockName("compact_launcher").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":compact_launcher");
|
||||
@ -3504,6 +3506,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(sat_dock, sat_dock.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(soyuz_capsule, soyuz_capsule.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_radar, machine_radar.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(radar_screen, radar_screen.getUnlocalizedName());
|
||||
|
||||
//Guide
|
||||
GameRegistry.registerBlock(book_guide, book_guide.getUnlocalizedName());
|
||||
|
||||
@ -2,43 +2,27 @@ package com.hbm.blocks.bomb;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.entity.missile.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier0.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier1.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier2.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier3.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier4.*;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.bomb.TileEntityLaunchPad;
|
||||
|
||||
import api.hbm.item.IDesignatorItem;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class LaunchPad extends BlockContainer implements IBomb {
|
||||
|
||||
public TileEntityLaunchPad tetn = new TileEntityLaunchPad();
|
||||
public static boolean keepInventory = false;
|
||||
private final static Random field_149933_a = new Random();
|
||||
|
||||
@ -51,11 +35,6 @@ public class LaunchPad extends BlockContainer implements IBomb {
|
||||
return new TileEntityLaunchPad();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return Item.getItemFromBlock(ModBlocks.launch_pad);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {
|
||||
if(!keepInventory) {
|
||||
@ -137,186 +116,16 @@ public class LaunchPad extends BlockContainer implements IBomb {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if(i == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(i == 1) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(i == 2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
if(i == 3) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public void setBlockBoundsBasedOnState(IBlockAccess
|
||||
* p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { float f
|
||||
* = 0.0625F; this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); }
|
||||
*
|
||||
* @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World
|
||||
* world, int x, int y, int z) { float f = 0.0625F;
|
||||
* this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 8*f, 1.0F); return
|
||||
* AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ,
|
||||
* x + this.maxX, y + this.maxY, z + this.maxZ); }
|
||||
*/
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
|
||||
return Item.getItemFromBlock(ModBlocks.launch_pad);
|
||||
}
|
||||
|
||||
@Spaghetti("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA *takes breath* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
|
||||
@Override
|
||||
public BombReturnCode explode(World world, int x, int y, int z) {
|
||||
|
||||
TileEntityLaunchPad entity = (TileEntityLaunchPad) world.getTileEntity(x, y, z);
|
||||
|
||||
if(entity.slots[0] == null || world.isRemote)
|
||||
return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
|
||||
if(entity.slots[1] != null && entity.slots[1].getItem() instanceof IDesignatorItem && entity.power >= 75000) {
|
||||
|
||||
if(!((IDesignatorItem)entity.slots[1].getItem()).isReady(world, entity.slots[1], x, y, z))
|
||||
return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
|
||||
int xCoord = entity.slots[1].stackTagCompound.getInteger("xCoord");
|
||||
int zCoord = entity.slots[1].stackTagCompound.getInteger("zCoord");
|
||||
|
||||
if(xCoord == entity.xCoord && zCoord == entity.zCoord) {
|
||||
xCoord += 1;
|
||||
}
|
||||
|
||||
Entity missile = null;
|
||||
|
||||
if(entity.slots[0].getItem() == ModItems.missile_generic) {
|
||||
missile = new EntityMissileGeneric(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_incendiary) {
|
||||
missile = new EntityMissileIncendiary(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_cluster) {
|
||||
missile = new EntityMissileCluster(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_buster) {
|
||||
missile = new EntityMissileBunkerBuster(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_strong) {
|
||||
missile = new EntityMissileStrong(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_incendiary_strong) {
|
||||
missile = new EntityMissileIncendiaryStrong(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_cluster_strong) {
|
||||
missile = new EntityMissileClusterStrong(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_buster_strong) {
|
||||
missile = new EntityMissileBusterStrong(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_burst) {
|
||||
missile = new EntityMissileBurst(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_inferno) {
|
||||
missile = new EntityMissileInferno(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_rain) {
|
||||
missile = new EntityMissileRain(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_drill) {
|
||||
missile = new EntityMissileDrill(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_nuclear) {
|
||||
missile = new EntityMissileNuclear(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_endo) {
|
||||
missile = new EntityMissileEndo(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_exo) {
|
||||
missile = new EntityMissileExo(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_nuclear_cluster) {
|
||||
missile = new EntityMissileMirv(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_doomsday) {
|
||||
missile = new EntityMissileDoomsday(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_taint) {
|
||||
missile = new EntityMissileTaint(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_micro) {
|
||||
missile = new EntityMissileMicro(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_bhole) {
|
||||
missile = new EntityMissileBHole(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_schrabidium) {
|
||||
missile = new EntityMissileSchrabidium(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_emp) {
|
||||
missile = new EntityMissileEMP(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_emp_strong) {
|
||||
missile = new EntityMissileEMPStrong(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_volcano) {
|
||||
missile = new EntityMissileVolcano(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
if(entity.slots[0].getItem() == ModItems.missile_shuttle) {
|
||||
missile = new EntityMissileShuttle(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord);
|
||||
}
|
||||
|
||||
if(missile != null) {
|
||||
world.spawnEntityInWorld(missile);
|
||||
world.playSoundEffect(x, y, z, "hbm:weapon.missileTakeOff", 2.0F, 1.0F);
|
||||
entity.power -= 75000;
|
||||
entity.slots[0] = null;
|
||||
|
||||
if(GeneralConfig.enableExtendedLogging)
|
||||
MainRegistry.logger.log(Level.INFO, "[MISSILE] Tried to launch missile at " + x + " / " + y + " / " + z + " to " + xCoord + " / " + zCoord + "!");
|
||||
return BombReturnCode.LAUNCHED;
|
||||
}
|
||||
}
|
||||
|
||||
if(entity.slots[0] != null && entity.slots[0].getItem() == ModItems.missile_carrier && entity.power >= 75000) {
|
||||
EntityCarrier missile = new EntityCarrier(world);
|
||||
missile.posX = x + 0.5F;
|
||||
missile.posY = y + 1F;
|
||||
missile.posZ = z + 0.5F;
|
||||
|
||||
if(entity.slots[1] != null)
|
||||
missile.setPayload(entity.slots[1]);
|
||||
|
||||
world.spawnEntityInWorld(missile);
|
||||
entity.power -= 75000;
|
||||
|
||||
entity.slots[0] = null;
|
||||
entity.slots[1] = null;
|
||||
world.playSoundEffect(x, y, z, "hbm:entity.rocketTakeoff", 100.0F, 1.0F);
|
||||
return BombReturnCode.LAUNCHED;
|
||||
}
|
||||
|
||||
if(entity.slots[0] != null && entity.slots[0].getItem() == ModItems.missile_anti_ballistic && entity.power >= 75000) {
|
||||
EntityMissileAntiBallistic missile = new EntityMissileAntiBallistic(world);
|
||||
missile.posX = x + 0.5F;
|
||||
missile.posY = y + 0.5F;
|
||||
missile.posZ = z + 0.5F;
|
||||
|
||||
world.spawnEntityInWorld(missile);
|
||||
entity.power -= 75000;
|
||||
|
||||
entity.slots[0] = null;
|
||||
world.playSoundEffect(x, y, z, "hbm:weapon.missileTakeOff", 2.0F, 1.0F);
|
||||
return BombReturnCode.LAUNCHED;
|
||||
}
|
||||
|
||||
return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
return entity.launchFromDesignator();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ public class MachineRadar extends BlockContainer {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(world.isRemote) {
|
||||
if(world.isRemote && !player.isSneaking()) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
|
||||
return true;
|
||||
} else if(!player.isSneaking()) {
|
||||
|
||||
56
src/main/java/com/hbm/blocks/machine/MachineRadarScreen.java
Normal file
56
src/main/java/com/hbm/blocks/machine/MachineRadarScreen.java
Normal file
@ -0,0 +1,56 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineRadarNT;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineRadarScreen;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineRadarScreen extends BlockDummyable {
|
||||
|
||||
public MachineRadarScreen(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return meta >= 12 ? new TileEntityMachineRadarScreen() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {1, 0, 0, 0, 1, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
if(world.isRemote && !player.isSneaking()) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
|
||||
if(pos == null) return false;
|
||||
|
||||
TileEntityMachineRadarScreen screen = (TileEntityMachineRadarScreen) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
|
||||
if(screen.linked && world.getTileEntity(screen.refX, screen.refY, screen.refZ) instanceof TileEntityMachineRadarNT) {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, screen.refX, screen.refY, screen.refZ);
|
||||
}
|
||||
|
||||
return false;
|
||||
} else if(!player.isSneaking()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -79,6 +79,8 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements
|
||||
this.aimAtTarget();
|
||||
}
|
||||
}
|
||||
|
||||
loadNeighboringChunks((int) Math.floor(posX / 16), (int) Math.floor(posZ / 16));
|
||||
|
||||
if(this.posY > 2000 && (this.tracking == null || this.tracking.isDead)) this.setDead();
|
||||
|
||||
@ -195,8 +197,7 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements
|
||||
clearChunkLoader();
|
||||
|
||||
loadedChunks.clear();
|
||||
loadedChunks.add(new ChunkCoordIntPair(newChunkX, newChunkZ));
|
||||
//loadedChunks.add(new ChunkCoordIntPair(newChunkX + (int) Math.floor((this.posX + this.motionX * this.motionMult()) / 16D), newChunkZ + (int) Math.floor((this.posZ + this.motionZ * this.motionMult()) / 16D)));
|
||||
for(int i = -1; i <= 1; i++) for(int j = -1; j <= 1; j++) loadedChunks.add(new ChunkCoordIntPair(newChunkX + i, newChunkZ + j));
|
||||
|
||||
for(ChunkCoordIntPair chunk : loadedChunks) {
|
||||
ForgeChunkManager.forceChunk(loaderTicket, chunk);
|
||||
|
||||
@ -21,57 +21,43 @@ public class ContainerLaunchPadTier1 extends Container {
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 80, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 134, 17));
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
for(int j = 0; j < 9; j++)
|
||||
{
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 9; j++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack())
|
||||
{
|
||||
|
||||
if(var4 != null && var4.getHasStack()) {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 2) {
|
||||
if (!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true))
|
||||
{
|
||||
|
||||
if(par2 <= 2) {
|
||||
if(!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
|
||||
if(var5.stackSize == 0) {
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return var3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.Arrays;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.NBTControlPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
@ -22,13 +23,16 @@ import net.minecraft.util.Vec3;
|
||||
|
||||
public class GUIMachineRadarNT extends GuiScreen {
|
||||
|
||||
protected static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_radar_nt.png");
|
||||
public static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_radar_nt.png");
|
||||
|
||||
protected TileEntityMachineRadarNT radar;
|
||||
protected int xSize = 216;
|
||||
protected int ySize = 234;
|
||||
protected int guiLeft;
|
||||
protected int guiTop;
|
||||
|
||||
public int lastMouseX;
|
||||
public int lastMouseY;
|
||||
|
||||
public GUIMachineRadarNT(TileEntityMachineRadarNT tile) {
|
||||
this.radar = tile;
|
||||
@ -71,6 +75,9 @@ public class GUIMachineRadarNT extends GuiScreen {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
this.lastMouseX = mouseX;
|
||||
this.lastMouseY = mouseY;
|
||||
}
|
||||
|
||||
private void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
@ -99,6 +106,12 @@ public class GUIMachineRadarNT extends GuiScreen {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(checkClick(mouseX, mouseY, 8, 17, 200, 200)) {
|
||||
int tX = (int) ((lastMouseX - guiLeft - 108) * ((double) TileEntityMachineRadarNT.radarRange * 2 + 1) / 192D + radar.xCoord);
|
||||
int tZ = (int) ((lastMouseY - guiTop - 117) * ((double) TileEntityMachineRadarNT.radarRange * 2 + 1) / 192D + radar.zCoord);
|
||||
this.func_146283_a(Arrays.asList(tX + " / " + tZ), lastMouseX, lastMouseY);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
@ -207,6 +220,37 @@ public class GUIMachineRadarNT extends GuiScreen {
|
||||
if(key == 1 || key == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
|
||||
this.mc.thePlayer.closeScreen();
|
||||
}
|
||||
|
||||
if(checkClick(lastMouseX, lastMouseY, 8, 17, 200, 200) && c >= '1' && c <= '8') {
|
||||
|
||||
int id = c - '1';
|
||||
|
||||
if(radar.slots[id] != null && radar.slots[id].getItem() == ModItems.radar_linker) {
|
||||
|
||||
if(!radar.entries.isEmpty()) {
|
||||
for(RadarEntry m : radar.entries) {
|
||||
int x = guiLeft + (int)((m.posX - radar.xCoord) / ((double) TileEntityMachineRadarNT.radarRange * 2 + 1) * (200D - 8D)) + 108;
|
||||
int z = guiTop + (int)((m.posZ - radar.zCoord) / ((double) TileEntityMachineRadarNT.radarRange * 2 + 1) * (200D - 8D)) + 117;
|
||||
|
||||
if(lastMouseX + 5 > x && lastMouseX - 4 <= x && lastMouseY + 5 > z && lastMouseY - 4 <= z) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("launchEntity", m.entityID);
|
||||
data.setInteger("link", id);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, radar.xCoord, radar.yCoord, radar.zCoord));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int tX = (int) ((lastMouseX - guiLeft - 108) * ((double) TileEntityMachineRadarNT.radarRange * 2 + 1) / 192D + radar.xCoord);
|
||||
int tZ = (int) ((lastMouseY - guiTop - 117) * ((double) TileEntityMachineRadarNT.radarRange * 2 + 1) / 192D + radar.zCoord);
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setInteger("launchPosX", tX);
|
||||
data.setInteger("launchPosZ", tZ);
|
||||
data.setInteger("link", id);
|
||||
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, radar.xCoord, radar.yCoord, radar.zCoord));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -12,6 +12,7 @@ import com.hbm.util.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.network.play.client.C0DPacketCloseWindow;
|
||||
@ -35,6 +36,7 @@ public class GUIMachineRadarNTSlots extends GuiInfoContainer {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(checkClick(x, y, 5, 5, 8, 8)) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
this.mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(this.mc.thePlayer.openContainer.windowId)); // closes the server-side GUI component without resetting the client's cursor position
|
||||
FMLNetworkHandler.openGui(this.mc.thePlayer, MainRegistry.instance, 0, radar.getWorldObj(), radar.xCoord, radar.yCoord, radar.zCoord);
|
||||
}
|
||||
|
||||
@ -1265,6 +1265,7 @@ public class ModItems {
|
||||
public static Item analysis_tool;
|
||||
public static Item coupling_tool;
|
||||
public static Item drone_linker;
|
||||
public static Item radar_linker;
|
||||
|
||||
public static Item template_folder;
|
||||
public static Item journal_pip;
|
||||
@ -4604,6 +4605,7 @@ public class ModItems {
|
||||
analysis_tool = new ItemAnalysisTool().setUnlocalizedName("analysis_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":analysis_tool");
|
||||
coupling_tool = new ItemCouplingTool().setUnlocalizedName("coupling_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":coupling_tool");
|
||||
drone_linker = new ItemDroneLinker().setUnlocalizedName("drone_linker").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":drone_linker");
|
||||
radar_linker = new ItemRadarLinker().setUnlocalizedName("radar_linker").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":radar_linker");
|
||||
|
||||
key = new ItemKey().setUnlocalizedName("key").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":key");
|
||||
key_red = new ItemCustomLore().setUnlocalizedName("key_red").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":key_red");
|
||||
@ -6779,6 +6781,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(mirror_tool, mirror_tool.getUnlocalizedName());
|
||||
GameRegistry.registerItem(rbmk_tool, rbmk_tool.getUnlocalizedName());
|
||||
GameRegistry.registerItem(drone_linker, drone_linker.getUnlocalizedName());
|
||||
GameRegistry.registerItem(radar_linker, radar_linker.getUnlocalizedName());
|
||||
GameRegistry.registerItem(coltan_tool, coltan_tool.getUnlocalizedName());
|
||||
GameRegistry.registerItem(power_net_tool, power_net_tool.getUnlocalizedName());
|
||||
GameRegistry.registerItem(analysis_tool, analysis_tool.getUnlocalizedName());
|
||||
|
||||
75
src/main/java/com/hbm/items/tool/ItemCoordinateBase.java
Normal file
75
src/main/java/com/hbm/items/tool/ItemCoordinateBase.java
Normal file
@ -0,0 +1,75 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class ItemCoordinateBase extends Item {
|
||||
|
||||
public static BlockPos getPosition(ItemStack stack) {
|
||||
|
||||
if(stack.hasTagCompound()) {
|
||||
return new BlockPos(stack.stackTagCompound.getInteger("posX"), stack.stackTagCompound.getInteger("posY"), stack.stackTagCompound.getInteger("posZ"));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
|
||||
|
||||
if(this.canGrabCoordinateHere(world, x, y, z)) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
BlockPos pos = this.getCoordinates(world, x, y, z);
|
||||
|
||||
if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
|
||||
|
||||
stack.stackTagCompound.setInteger("posX", pos.getX());
|
||||
if(includeY()) stack.stackTagCompound.setInteger("posY", pos.getY());
|
||||
stack.stackTagCompound.setInteger("posZ", pos.getZ());
|
||||
|
||||
this.onTargetSet(world, pos.getX(), pos.getY(), pos.getZ(), player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Whether this position can be saved or if the position target is valid */
|
||||
public abstract boolean canGrabCoordinateHere(World world, int x, int y, int z);
|
||||
|
||||
/** Whether this linking item saves the Y coordinate */
|
||||
public boolean includeY() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Modified the saved coordinates, for example detecting the core for multiblocks */
|
||||
public BlockPos getCoordinates(World world, int x, int y, int z) {
|
||||
return new BlockPos(x, y, z);
|
||||
}
|
||||
|
||||
/** Extra on successful target set, eg. sounds */
|
||||
public void onTargetSet(World world, int x, int y, int z, EntityPlayer player) { }
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
|
||||
if(stack.hasTagCompound()) {
|
||||
list.add("X: " + stack.stackTagCompound.getInteger("posX"));
|
||||
if(includeY()) list.add("Y: " + stack.stackTagCompound.getInteger("posY"));
|
||||
list.add("Z: " + stack.stackTagCompound.getInteger("posZ"));
|
||||
} else {
|
||||
list.add(EnumChatFormatting.RED + "No position set!");
|
||||
}
|
||||
}
|
||||
}
|
||||
30
src/main/java/com/hbm/items/tool/ItemRadarLinker.java
Normal file
30
src/main/java/com/hbm/items/tool/ItemRadarLinker.java
Normal file
@ -0,0 +1,30 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import com.hbm.tileentity.IRadarCommandReceiver;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineRadarScreen;
|
||||
import com.hbm.util.CompatExternal;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemRadarLinker extends ItemCoordinateBase {
|
||||
|
||||
@Override
|
||||
public boolean canGrabCoordinateHere(World world, int x, int y, int z) {
|
||||
TileEntity tile = CompatExternal.getCoreFromPos(world, x, y, z);
|
||||
return tile instanceof IRadarCommandReceiver || tile instanceof TileEntityMachineRadarScreen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getCoordinates(World world, int x, int y, int z) {
|
||||
TileEntity tile = CompatExternal.getCoreFromPos(world, x, y, z);
|
||||
return new BlockPos(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTargetSet(World world, int x, int y, int z, EntityPlayer player) {
|
||||
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@ -242,6 +242,7 @@ public class ClientProxy extends ServerProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineEPress.class, new RenderEPress());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineRadGen.class, new RenderRadGen());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineRadarNT.class, new RenderRadar());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineRadarScreen.class, new RenderRadarScreen());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineSeleniumEngine.class, new RenderSelenium());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityReactorResearch.class, new RenderSmallReactor());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineShredderLarge.class, new RenderMachineShredder());
|
||||
|
||||
@ -40,6 +40,7 @@ import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.saveddata.satellites.Satellite;
|
||||
import com.hbm.tileentity.TileMappings;
|
||||
import com.hbm.tileentity.bomb.TileEntityLaunchPad;
|
||||
import com.hbm.tileentity.bomb.TileEntityNukeCustom;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
|
||||
import com.hbm.tileentity.machine.TileEntityNukeFurnace;
|
||||
@ -324,6 +325,7 @@ public class MainRegistry {
|
||||
|
||||
TileMappings.writeMappings();
|
||||
MachineDynConfig.initialize();
|
||||
TileEntityLaunchPad.registerLaunchables();
|
||||
|
||||
for(Entry<Class<? extends TileEntity>, String[]> e : TileMappings.map.entrySet()) {
|
||||
|
||||
|
||||
@ -242,6 +242,7 @@ public class ResourceManager {
|
||||
public static final IModelCustom radar_body = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/radar_base.obj"));
|
||||
public static final IModelCustom radar_head = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/radar_head.obj"));
|
||||
public static final IModelCustom radar = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/radar.obj"));
|
||||
public static final IModelCustom radar_screen = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/machines/radar_screen.obj"));
|
||||
|
||||
//Forcefield
|
||||
public static final IModelCustom forcefield_top = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/forcefield_top.obj"));
|
||||
@ -630,6 +631,7 @@ public class ResourceManager {
|
||||
public static final ResourceLocation radar_head_tex = new ResourceLocation(RefStrings.MODID, "textures/models/radar_head.png");
|
||||
public static final ResourceLocation radar_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/radar_base.png");
|
||||
public static final ResourceLocation radar_dish_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/radar_dish.png");
|
||||
public static final ResourceLocation radar_screen_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/radar_screen.png");
|
||||
|
||||
//Forcefield
|
||||
public static final ResourceLocation forcefield_base_tex = new ResourceLocation(RefStrings.MODID, "textures/models/forcefield_base.png");
|
||||
|
||||
@ -0,0 +1,94 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.inventory.gui.GUIMachineRadarNT;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineRadarNT;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineRadarScreen;
|
||||
|
||||
import api.hbm.entity.RadarEntry;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class RenderRadarScreen extends TileEntitySpecialRenderer {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
switch(tileEntity.getBlockMetadata() - BlockDummyable.offset) {
|
||||
case 2: GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
case 4: GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 3: GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 5: GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
}
|
||||
|
||||
TileEntityMachineRadarScreen screen = (TileEntityMachineRadarScreen) tileEntity;
|
||||
|
||||
bindTexture(ResourceManager.radar_screen_tex);
|
||||
ResourceManager.radar_screen.renderAll();
|
||||
|
||||
bindTexture(GUIMachineRadarNT.texture);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
if(screen.linked) {
|
||||
tess.startDrawingQuads();
|
||||
|
||||
double offset = ((tileEntity.getWorldObj().getTotalWorldTime() % 56) + f) / 30D;
|
||||
tess.setColorRGBA_I(0x00ff00, 0);
|
||||
tess.addVertex(0.38, 2 - offset, 1.375);
|
||||
tess.addVertex(0.38, 2 - offset, -0.375);
|
||||
tess.setColorRGBA_I(0x00ff00, 50);
|
||||
tess.addVertex(0.38, 2 - offset - 0.125, -0.375);
|
||||
tess.addVertex(0.38, 2 - offset - 0.125, 1.375);
|
||||
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
tess.draw();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
|
||||
if(!screen.entries.isEmpty()) {
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0F, 1F, 0F);
|
||||
|
||||
for(RadarEntry entry : screen.entries) {
|
||||
|
||||
double sX = (entry.posX - screen.refX) / ((double) TileEntityMachineRadarNT.radarRange + 1) * (0.875D);
|
||||
double sZ = (entry.posZ - screen.refZ) / ((double) TileEntityMachineRadarNT.radarRange + 1) * (0.875D);
|
||||
double size = 0.0625D;
|
||||
tess.addVertexWithUV(0.38, 1 - sZ + size, 0.5 - sX + size, 216D / 256D, (entry.blipLevel * 8F + 8F) / 256F);
|
||||
tess.addVertexWithUV(0.38, 1 - sZ + size, 0.5 - sX - size, 224D / 256D, (entry.blipLevel * 8F + 8F) / 256F);
|
||||
tess.addVertexWithUV(0.38, 1 - sZ - size, 0.5 - sX - size, 224D / 256D, entry.blipLevel * 8F / 256F);
|
||||
tess.addVertexWithUV(0.38, 1 - sZ - size, 0.5 - sX + size, 216D / 256D, entry.blipLevel * 8F / 256F);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
tess.draw();
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
} else {
|
||||
int offset = 118 + tileEntity.getWorldObj().rand.nextInt(81);
|
||||
tess.startDrawingQuads();
|
||||
tess.setColorOpaque_I(0xffffff);
|
||||
tess.setNormal(0F, 1F, 0F);
|
||||
tess.addVertexWithUV(0.38, 1.875, 1.375, 216D / 256D, (offset + 40F) / 256F);
|
||||
tess.addVertexWithUV(0.38, 1.875, -0.375, 256D / 256D, (offset + 40F) / 256F);
|
||||
tess.addVertexWithUV(0.38, 0.125, -0.375, 256D / 256D, offset / 256F);
|
||||
tess.addVertexWithUV(0.38, 0.125, 1.375, 216D / 256D, offset / 256F);
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public interface IRadarCommandReceiver {
|
||||
|
||||
public boolean sendCommandPosition(int x, int y, int z);
|
||||
public boolean sendCommandEntity(Entity target);
|
||||
}
|
||||
@ -113,6 +113,7 @@ public class TileMappings {
|
||||
put(TileEntityMachineRadGen.class, "tileentity_radgen");
|
||||
put(TileEntityMachineTransformer.class, "tileentity_transformer");
|
||||
put(TileEntityMachineRadarNT.class, "tileentity_radar");
|
||||
put(TileEntityMachineRadarScreen.class, "tileentity_radar_screen");
|
||||
put(TileEntityBroadcaster.class, "tileentity_pink_cloud_broadcaster");
|
||||
put(TileEntityMachineSeleniumEngine.class, "tileentity_selenium_engine");
|
||||
put(TileEntityMachineSatLinker.class, "tileentity_satlinker");
|
||||
|
||||
@ -1,13 +1,31 @@
|
||||
package com.hbm.tileentity.bomb;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.bomb.LaunchPad;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.entity.missile.EntityCarrier;
|
||||
import com.hbm.entity.missile.EntityMissileAntiBallistic;
|
||||
import com.hbm.entity.missile.EntityMissileBaseNT;
|
||||
import com.hbm.entity.missile.EntityMissileShuttle;
|
||||
import com.hbm.entity.missile.EntityMissileTier0.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier1.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier2.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier3.*;
|
||||
import com.hbm.entity.missile.EntityMissileTier4.*;
|
||||
import com.hbm.interfaces.IBomb.BombReturnCode;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.container.ContainerLaunchPadTier1;
|
||||
import com.hbm.inventory.gui.GUILaunchPadTier1;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.tileentity.IRadarCommandReceiver;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.item.IDesignatorItem;
|
||||
@ -19,184 +37,72 @@ import li.cil.oc.api.machine.Callback;
|
||||
import li.cil.oc.api.machine.Context;
|
||||
import li.cil.oc.api.network.SimpleComponent;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
|
||||
public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedInventory, INBTPacketReceiver, IEnergyUser, SimpleComponent, IGUIProvider {
|
||||
public class TileEntityLaunchPad extends TileEntityMachineBase implements IEnergyUser, SimpleComponent, IGUIProvider, IRadarCommandReceiver {
|
||||
|
||||
/** Automatic instantiation of generic missiles, i.e. everything that both extends EntityMissileBaseNT and needs a designator */
|
||||
public static final HashMap<ComparableStack, Class<? extends EntityMissileBaseNT>> missiles = new HashMap();
|
||||
|
||||
public static void registerLaunchables() {
|
||||
|
||||
//Tier 0
|
||||
missiles.put(new ComparableStack(ModItems.missile_micro), EntityMissileMicro.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_schrabidium), EntityMissileSchrabidium.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_bhole), EntityMissileBHole.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_taint), EntityMissileTaint.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_emp), EntityMissileEMP.class);
|
||||
//Tier 1
|
||||
missiles.put(new ComparableStack(ModItems.missile_generic), EntityMissileGeneric.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_incendiary), EntityMissileIncendiary.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_cluster), EntityMissileCluster.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_buster), EntityMissileBunkerBuster.class);
|
||||
//Tier 2
|
||||
missiles.put(new ComparableStack(ModItems.missile_strong), EntityMissileStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_incendiary_strong), EntityMissileIncendiaryStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_cluster_strong), EntityMissileClusterStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_buster_strong), EntityMissileBusterStrong.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_emp_strong), EntityMissileEMPStrong.class);
|
||||
//Tier 3
|
||||
missiles.put(new ComparableStack(ModItems.missile_burst), EntityMissileBurst.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_inferno), EntityMissileInferno.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_rain), EntityMissileRain.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_drill), EntityMissileDrill.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_endo), EntityMissileEndo.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_exo), EntityMissileExo.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_shuttle), EntityMissileShuttle.class);
|
||||
//Tier 4
|
||||
missiles.put(new ComparableStack(ModItems.missile_nuclear), EntityMissileNuclear.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_nuclear_cluster), EntityMissileMirv.class);
|
||||
missiles.put(new ComparableStack(ModItems.missile_volcano), EntityMissileVolcano.class);
|
||||
}
|
||||
|
||||
public ItemStack slots[];
|
||||
public ItemStack toRender;
|
||||
|
||||
public long power;
|
||||
public final long maxPower = 100000;
|
||||
|
||||
private static final int[] slots_top = new int[] {0};
|
||||
private static final int[] slots_bottom = new int[] { 0, 1, 2};
|
||||
private static final int[] slots_bottom = new int[] {0, 1, 2};
|
||||
private static final int[] slots_side = new int[] {0};
|
||||
private String customName;
|
||||
|
||||
public TileEntityLaunchPad() {
|
||||
slots = new ItemStack[3];
|
||||
super(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return slots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return slots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
slots[i] = itemStack;
|
||||
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return this.hasCustomInventoryName() ? this.customName : "container.launchPad";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomName(String name) {
|
||||
this.customName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
|
||||
{
|
||||
return false;
|
||||
}else{
|
||||
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
|
||||
}
|
||||
}
|
||||
|
||||
//You scrubs aren't needed for anything (right now)
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
if(slots[i].stackSize <= j)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
}
|
||||
ItemStack itemStack1 = slots[i].splitStack(j);
|
||||
if (slots[i].stackSize == 0)
|
||||
{
|
||||
slots[i] = null;
|
||||
}
|
||||
|
||||
return itemStack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
power = nbt.getLong("power");
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
|
||||
byte b0 = nbt1.getByte("slot");
|
||||
if(b0 >= 0 && b0 < slots.length)
|
||||
{
|
||||
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
NBTTagList list = new NBTTagList();
|
||||
nbt.setLong("power", power);
|
||||
|
||||
for(int i = 0; i < slots.length; i++)
|
||||
{
|
||||
if(slots[i] != null)
|
||||
{
|
||||
NBTTagCompound nbt1 = new NBTTagCompound();
|
||||
nbt1.setByte("slot", (byte)i);
|
||||
slots[i].writeToNBT(nbt1);
|
||||
list.appendTag(nbt1);
|
||||
}
|
||||
}
|
||||
nbt.setTag("items", list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
|
||||
{
|
||||
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
|
||||
return this.isItemValidForSlot(i, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) {
|
||||
return (power * i) / maxPower;
|
||||
public String getName() {
|
||||
return "container.launchPad";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -213,8 +119,7 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
||||
data.setInteger("id", Item.getIdFromItem(slots[0].getItem()));
|
||||
data.setShort("meta", (short) slots[0].getItemDamage());
|
||||
}
|
||||
|
||||
INBTPacketReceiver.networkPack(this, data, 250);
|
||||
networkPack(data, 250);
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,6 +141,34 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord - 1, Library.NEG_Z);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
power = nbt.getLong("power");
|
||||
|
||||
if(slots == null || slots.length != 3) slots = new ItemStack[3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setLong("power", power);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return side == 0 ? slots_bottom : (side == 1 ? new int[0] : slots_side);
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
@ -245,13 +178,11 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -261,16 +192,12 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
||||
|
||||
@Override
|
||||
public long transferPower(long power) {
|
||||
|
||||
this.power += power;
|
||||
|
||||
if(this.power > this.getMaxPower()) {
|
||||
|
||||
long overshoot = this.power - this.getMaxPower();
|
||||
this.power = this.getMaxPower();
|
||||
return overshoot;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -281,11 +208,121 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared()
|
||||
{
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
public boolean hasPower() {
|
||||
return this.power >= 75_000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendCommandPosition(int x, int y, int z) {
|
||||
return this.launchToCoordinate(x, z) == BombReturnCode.LAUNCHED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendCommandEntity(Entity target) {
|
||||
return this.launchToEntity(target) == BombReturnCode.LAUNCHED;
|
||||
}
|
||||
|
||||
public BombReturnCode launchFromDesignator() {
|
||||
if(slots[0] == null) return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
|
||||
boolean needsDesignator = missiles.containsKey(new ComparableStack(slots[0]).makeSingular());
|
||||
|
||||
int targetX = 0;
|
||||
int targetZ = 0;
|
||||
|
||||
if(slots[1] != null && slots[1].getItem() instanceof IDesignatorItem) {
|
||||
|
||||
IDesignatorItem designator = (IDesignatorItem) slots[1].getItem();
|
||||
|
||||
if(!designator.isReady(worldObj, slots[1], xCoord, yCoord, zCoord) && needsDesignator) return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
|
||||
Vec3 coords = designator.getCoords(worldObj, slots[1], xCoord, yCoord, zCoord);
|
||||
targetX = (int) Math.floor(coords.xCoord);
|
||||
targetZ = (int) Math.floor(coords.zCoord);
|
||||
|
||||
} else {
|
||||
if(needsDesignator) return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
}
|
||||
|
||||
return this.launchToCoordinate(targetX, targetZ);
|
||||
}
|
||||
|
||||
public BombReturnCode launchToEntity(Entity entity) {
|
||||
if(!hasPower()) return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
Entity e = instantiateMissile((int) Math.floor(entity.posX), (int) Math.floor(entity.posZ));
|
||||
if(e != null) {
|
||||
|
||||
if(e instanceof EntityMissileAntiBallistic) {
|
||||
EntityMissileAntiBallistic abm = (EntityMissileAntiBallistic) e;
|
||||
abm.tracking = entity;
|
||||
}
|
||||
|
||||
finalizeLaunch(e);
|
||||
return BombReturnCode.LAUNCHED;
|
||||
}
|
||||
return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
}
|
||||
|
||||
public BombReturnCode launchToCoordinate(int targetX, int targetZ) {
|
||||
if(!hasPower()) return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
Entity e = instantiateMissile(targetX, targetZ);
|
||||
if(e != null) {
|
||||
finalizeLaunch(e);
|
||||
return BombReturnCode.LAUNCHED;
|
||||
}
|
||||
return BombReturnCode.ERROR_MISSING_COMPONENT;
|
||||
}
|
||||
|
||||
public Entity instantiateMissile(int targetX, int targetZ) {
|
||||
|
||||
if(slots[0] == null) return null;
|
||||
|
||||
if(slots[0].getItem() == ModItems.missile_carrier) {
|
||||
EntityCarrier missile = new EntityCarrier(worldObj);
|
||||
missile.posX = xCoord + 0.5F;
|
||||
missile.posY = yCoord + 1F;
|
||||
missile.posZ = zCoord + 0.5F;
|
||||
if(slots[1] != null) {
|
||||
missile.setPayload(slots[1]);
|
||||
this.slots[1] = null;
|
||||
}
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord, zCoord + 0.5, "hbm:entity.rocketTakeoff", 100.0F, 1.0F);
|
||||
return missile;
|
||||
}
|
||||
|
||||
Class<? extends EntityMissileBaseNT> clazz = this.missiles.get(new ComparableStack(slots[0]).makeSingular());
|
||||
|
||||
if(clazz != null) {
|
||||
try {
|
||||
EntityMissileBaseNT missile = clazz.getConstructor(World.class, float.class, float.class, float.class, int.class, int.class).newInstance(worldObj, xCoord + 0.5F, yCoord + 2F, zCoord + 0.5F, targetX, targetZ);
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord, zCoord + 0.5, "hbm:weapon.missileTakeOff", 2.0F, 1.0F);
|
||||
if(GeneralConfig.enableExtendedLogging) MainRegistry.logger.log(Level.INFO, "[MISSILE] Tried to launch missile at " + xCoord + " / " + yCoord + " / " + zCoord + " to " + xCoord + " / " + zCoord + "!");
|
||||
return missile;
|
||||
} catch(Exception e) { }
|
||||
}
|
||||
|
||||
if(slots[0].getItem() == ModItems.missile_anti_ballistic) {
|
||||
EntityMissileAntiBallistic missile = new EntityMissileAntiBallistic(worldObj);
|
||||
missile.posX = xCoord + 0.5F;
|
||||
missile.posY = yCoord + 0.5F;
|
||||
missile.posZ = zCoord + 0.5F;
|
||||
worldObj.playSoundEffect(xCoord + 0.5, yCoord, zCoord + 0.5, "hbm:weapon.missileTakeOff", 2.0F, 1.0F);
|
||||
return missile;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void finalizeLaunch(Entity missile) {
|
||||
this.power -= 75_000;
|
||||
worldObj.spawnEntityInWorld(missile);
|
||||
this.decrStackSize(0, 1);
|
||||
}
|
||||
|
||||
// do some opencomputer stuff
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
@ -337,7 +374,6 @@ public class TileEntityLaunchPad extends TileEntityLoadedBase implements ISidedI
|
||||
@Callback
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
public Object[] launch(Context context, Arguments args) {
|
||||
//worldObj.getBlock(xCoord, yCoord, zCoord).explode(worldObj, xCoord, yCoord, zCoord);
|
||||
((LaunchPad) ModBlocks.launch_pad).explode(worldObj, xCoord, yCoord, zCoord);
|
||||
return new Object[] {};
|
||||
}
|
||||
|
||||
@ -14,12 +14,16 @@ import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.container.ContainerMachineRadarNT;
|
||||
import com.hbm.inventory.gui.GUIMachineRadarNT;
|
||||
import com.hbm.inventory.gui.GUIMachineRadarNTSlots;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemCoordinateBase;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.IConfigurableMachine;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IRadarCommandReceiver;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.Tuple.Triplet;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.entity.IRadarDetectable;
|
||||
@ -36,7 +40,9 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
@ -164,8 +170,27 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I
|
||||
}
|
||||
}
|
||||
|
||||
if(slots[8] != null && slots[8].getItem() == ModItems.radar_linker) {
|
||||
BlockPos pos = ItemCoordinateBase.getPosition(slots[8]);
|
||||
if(pos != null) {
|
||||
TileEntity tile = worldObj.getTileEntity(pos.getX(), pos.getY(), pos.getZ());
|
||||
if(tile instanceof TileEntityMachineRadarScreen) {
|
||||
TileEntityMachineRadarScreen screen = (TileEntityMachineRadarScreen) tile;
|
||||
screen.entries.clear();
|
||||
screen.entries.addAll(this.entries);
|
||||
screen.refX = xCoord;
|
||||
screen.refY = yCoord;
|
||||
screen.refZ = zCoord;
|
||||
screen.linked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.networkPackNT(50);
|
||||
if(this.clearFlag) this.clearFlag = false;
|
||||
if(this.clearFlag) {
|
||||
this.map = new byte[40_000];
|
||||
this.clearFlag = false;
|
||||
}
|
||||
} else {
|
||||
prevRotation = rotation;
|
||||
if(power > 0) rotation += 5F;
|
||||
@ -373,6 +398,37 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I
|
||||
if(data.hasKey("clear")) this.clearFlag = true;
|
||||
|
||||
if(data.hasKey("gui1")) FMLNetworkHandler.openGui(player, MainRegistry.instance, 1, worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
if(data.hasKey("link")) {
|
||||
int id = data.getInteger("link");
|
||||
ItemStack link = slots[id];
|
||||
|
||||
if(link != null && link.getItem() == ModItems.radar_linker) {
|
||||
BlockPos pos = ItemCoordinateBase.getPosition(link);
|
||||
|
||||
if(pos != null) {
|
||||
TileEntity tile = worldObj.getTileEntity(pos.getX(), pos.getY(), pos.getZ());
|
||||
if(tile instanceof IRadarCommandReceiver) {
|
||||
IRadarCommandReceiver rec = (IRadarCommandReceiver) tile;
|
||||
|
||||
if(data.hasKey("launchEntity")) {
|
||||
Entity entity = worldObj.getEntityByID(data.getInteger("launchEntity"));
|
||||
if(entity != null) {
|
||||
if(rec.sendCommandEntity(entity)) {
|
||||
worldObj.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
} else if(data.hasKey("launchPosX")) {
|
||||
int x = data.getInteger("launchPosX");
|
||||
int z = data.getInteger("launchPosZ");
|
||||
if(rec.sendCommandPosition(x, yCoord, z)) {
|
||||
worldObj.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AxisAlignedBB bb = null;
|
||||
@ -400,6 +456,15 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
|
||||
return false;
|
||||
} else {
|
||||
return player.getDistance(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 128;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if(ID == 1) return new ContainerMachineRadarNT(player.inventory, this);
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.packet.BufPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.IBufPacketReceiver;
|
||||
|
||||
import api.hbm.entity.RadarEntry;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityMachineRadarScreen extends TileEntity implements IBufPacketReceiver {
|
||||
|
||||
public List<RadarEntry> entries = new ArrayList();
|
||||
public int refX;
|
||||
public int refY;
|
||||
public int refZ;
|
||||
public boolean linked;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
this.networkPackNT(100);
|
||||
entries.clear();
|
||||
this.linked = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void networkPackNT(int range) {
|
||||
if(!worldObj.isRemote) PacketDispatcher.wrapper.sendToAllAround(new BufPacket(xCoord, yCoord, zCoord, this), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, range));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf buf) {
|
||||
buf.writeBoolean(linked);
|
||||
buf.writeInt(refX);
|
||||
buf.writeInt(refY);
|
||||
buf.writeInt(refZ);
|
||||
buf.writeInt(entries.size());
|
||||
for(RadarEntry entry : entries) entry.toBytes(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(ByteBuf buf) {
|
||||
linked = buf.readBoolean();
|
||||
refX = buf.readInt();
|
||||
refY = buf.readInt();
|
||||
refZ = buf.readInt();
|
||||
int count = buf.readInt();
|
||||
this.entries.clear();
|
||||
for(int i = 0; i < count; i++) {
|
||||
RadarEntry entry = new RadarEntry();
|
||||
entry.fromBytes(buf);
|
||||
this.entries.add(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -303,13 +303,14 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen
|
||||
if(tPos != null)
|
||||
this.alignTurret();
|
||||
} else {
|
||||
|
||||
this.target = null;
|
||||
this.tPos = null;
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(!isOn()) this.targetQueue.clear();
|
||||
|
||||
if(this.target != null && !target.isEntityAlive()) {
|
||||
this.target = null;
|
||||
this.tPos = null;
|
||||
|
||||
@ -3,12 +3,24 @@ package com.hbm.tileentity.turret;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.tileentity.IRadarCommandReceiver;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public abstract class TileEntityTurretBaseArtillery extends TileEntityTurretBaseNT {
|
||||
public abstract class TileEntityTurretBaseArtillery extends TileEntityTurretBaseNT implements IRadarCommandReceiver {
|
||||
|
||||
protected List<Vec3> targetQueue = new ArrayList();
|
||||
|
||||
public boolean sendCommandPosition(int x, int y, int z) {
|
||||
this.enqueueTarget(x + 0.5, y, z + 0.5);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean sendCommandEntity(Entity target) {
|
||||
this.enqueueTarget(target.posX, target.posY, target.posZ);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void enqueueTarget(double x, double y, double z) {
|
||||
|
||||
|
||||
@ -222,6 +222,8 @@ public class TileEntityTurretHIMARS extends TileEntityTurretBaseArtillery implem
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(!isOn()) this.targetQueue.clear();
|
||||
|
||||
if(this.target != null && !target.isEntityAlive()) {
|
||||
this.target = null;
|
||||
this.tPos = null;
|
||||
|
||||
140
src/main/resources/assets/hbm/models/machines/radar_screen.obj
Normal file
140
src/main/resources/assets/hbm/models/machines/radar_screen.obj
Normal file
@ -0,0 +1,140 @@
|
||||
# Blender v2.79 (sub 0) OBJ File: 'radar_screen.blend'
|
||||
# www.blender.org
|
||||
o Plane
|
||||
v -0.250000 0.000000 1.500000
|
||||
v 0.500000 0.000000 1.500000
|
||||
v -0.250000 0.000000 -0.500000
|
||||
v 0.500000 0.000000 -0.500000
|
||||
v -0.250000 2.000000 -0.500000
|
||||
v -0.250000 2.000000 1.500000
|
||||
v 0.500000 2.000000 1.500000
|
||||
v 0.500000 2.000000 -0.500000
|
||||
v -0.250000 0.250000 -0.250000
|
||||
v -0.250000 0.250000 1.250000
|
||||
v -0.250000 1.750000 -0.250000
|
||||
v -0.250000 1.750000 1.250000
|
||||
v -0.500000 0.250000 -0.250000
|
||||
v -0.500000 0.250000 1.250000
|
||||
v -0.500000 1.750000 -0.250000
|
||||
v -0.500000 1.750000 1.250000
|
||||
v 0.500000 0.125000 1.375000
|
||||
v 0.500000 0.125000 -0.375000
|
||||
v 0.500000 1.875000 1.375000
|
||||
v 0.500000 1.875000 -0.375000
|
||||
v 0.375000 0.125000 1.375000
|
||||
v 0.375000 0.125000 -0.375000
|
||||
v 0.375000 1.875000 1.375000
|
||||
v 0.375000 1.875000 -0.375000
|
||||
vt 0.500000 0.000000
|
||||
vt 0.136364 0.214286
|
||||
vt 0.136364 0.000000
|
||||
vt 0.136364 0.785714
|
||||
vt 0.500000 1.000000
|
||||
vt 0.136364 1.000000
|
||||
vt 0.636364 0.214286
|
||||
vt 0.500000 0.785714
|
||||
vt 0.500000 0.214286
|
||||
vt 0.000000 0.785714
|
||||
vt 0.000000 0.214286
|
||||
vt 0.159091 0.750000
|
||||
vt 0.681818 0.714286
|
||||
vt 0.636364 0.785714
|
||||
vt 0.500000 0.107143
|
||||
vt 0.772727 0.035714
|
||||
vt 0.772727 0.107143
|
||||
vt 0.954545 0.714286
|
||||
vt 1.000000 0.785714
|
||||
vt 1.000000 0.214286
|
||||
vt 0.681818 0.285714
|
||||
vt 0.954545 0.285714
|
||||
vt 0.954545 0.267857
|
||||
vt 0.681818 0.714286
|
||||
vt 0.681818 0.267857
|
||||
vt 0.500000 0.107143
|
||||
vt 0.772727 0.035714
|
||||
vt 0.772727 0.107143
|
||||
vt 0.500000 0.107143
|
||||
vt 0.772727 0.035714
|
||||
vt 0.772727 0.107143
|
||||
vt 0.500000 0.107143
|
||||
vt 0.772727 0.035714
|
||||
vt 0.772727 0.107143
|
||||
vt 0.818182 -0.000000
|
||||
vt 0.500000 0.035714
|
||||
vt 0.500000 0.000000
|
||||
vt 0.477273 0.750000
|
||||
vt 0.159091 0.250000
|
||||
vt 0.477273 0.250000
|
||||
vt 0.477273 0.250000
|
||||
vt 0.159091 0.750000
|
||||
vt 0.159091 0.250000
|
||||
vt 0.818182 0.000000
|
||||
vt 0.500000 0.035714
|
||||
vt 0.500000 0.000000
|
||||
vt 0.818182 0.000000
|
||||
vt 0.500000 0.035714
|
||||
vt 0.500000 0.000000
|
||||
vt 0.818182 -0.000000
|
||||
vt 0.500000 0.035714
|
||||
vt 0.500000 0.000000
|
||||
vt 0.500000 0.035714
|
||||
vt 0.954545 0.714286
|
||||
vt 0.500000 0.035714
|
||||
vt 0.500000 0.035714
|
||||
vt 0.500000 0.035714
|
||||
vt 0.818182 0.035714
|
||||
vt 0.477273 0.750000
|
||||
vt 0.818182 0.035714
|
||||
vt 0.818182 0.035714
|
||||
vt 0.818182 0.035714
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
s off
|
||||
f 3/1/1 2/2/1 1/3/1
|
||||
f 7/4/2 5/5/2 6/6/2
|
||||
f 3/7/3 8/8/3 4/9/3
|
||||
f 2/2/4 6/10/4 1/11/4
|
||||
f 2/2/5 19/12/5 7/4/5
|
||||
f 3/7/6 11/13/6 5/14/6
|
||||
f 9/15/3 15/16/3 11/17/3
|
||||
f 5/14/6 12/18/6 6/19/6
|
||||
f 1/20/6 9/21/6 3/7/6
|
||||
f 6/19/6 10/22/6 1/20/6
|
||||
f 14/23/6 15/24/6 13/25/6
|
||||
f 10/26/1 13/27/1 9/28/1
|
||||
f 12/29/4 14/30/4 10/31/4
|
||||
f 11/32/2 16/33/2 12/34/2
|
||||
f 20/35/4 22/36/4 18/37/4
|
||||
f 7/4/5 20/38/5 8/8/5
|
||||
f 4/9/5 17/39/5 2/2/5
|
||||
f 8/8/5 18/40/5 4/9/5
|
||||
f 22/41/5 23/42/5 21/43/5
|
||||
f 18/44/2 21/45/2 17/46/2
|
||||
f 17/47/3 23/48/3 19/49/3
|
||||
f 19/50/1 24/51/1 20/52/1
|
||||
f 3/1/1 4/9/1 2/2/1
|
||||
f 7/4/2 8/8/2 5/5/2
|
||||
f 3/7/3 5/14/3 8/8/3
|
||||
f 2/2/4 7/4/4 6/10/4
|
||||
f 2/2/5 17/39/5 19/12/5
|
||||
f 3/7/6 9/21/6 11/13/6
|
||||
f 9/15/3 13/53/3 15/16/3
|
||||
f 5/14/6 11/13/6 12/18/6
|
||||
f 1/20/6 10/22/6 9/21/6
|
||||
f 6/19/6 12/18/6 10/22/6
|
||||
f 14/23/6 16/54/6 15/24/6
|
||||
f 10/26/1 14/55/1 13/27/1
|
||||
f 12/29/4 16/56/4 14/30/4
|
||||
f 11/32/2 15/57/2 16/33/2
|
||||
f 20/35/4 24/58/4 22/36/4
|
||||
f 7/4/5 19/12/5 20/38/5
|
||||
f 4/9/5 18/40/5 17/39/5
|
||||
f 8/8/5 20/38/5 18/40/5
|
||||
f 22/41/5 24/59/5 23/42/5
|
||||
f 18/44/2 22/60/2 21/45/2
|
||||
f 17/47/3 21/61/3 23/48/3
|
||||
f 19/50/1 23/62/1 24/51/1
|
||||
|
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
Binary file not shown.
|
After Width: | Height: | Size: 621 B |
Loading…
x
Reference in New Issue
Block a user