updated ICBM api
This commit is contained in:
parent
090c84b48f
commit
75b5ace914
22 changed files with 295 additions and 151 deletions
|
@ -6,10 +6,10 @@ package icbm.api;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface IBlockFrequency {
|
public interface IBlockFrequency
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @param data
|
* @param data - Pass an ItemStack if dealing with items with frequencies.
|
||||||
* - Pass an ItemStack if dealing with items with frequencies.
|
|
||||||
* @return The frequency of this object.
|
* @return The frequency of this object.
|
||||||
*/
|
*/
|
||||||
public int getFrequency();
|
public int getFrequency();
|
||||||
|
@ -17,10 +17,8 @@ public interface IBlockFrequency {
|
||||||
/**
|
/**
|
||||||
* Sets the frequency
|
* Sets the frequency
|
||||||
*
|
*
|
||||||
* @param frequency
|
* @param frequency - The frequency of this object.
|
||||||
* - The frequency of this object.
|
* @param data - Pass an ItemStack if dealing with items with frequencies.
|
||||||
* @param data
|
|
||||||
* - Pass an ItemStack if dealing with items with frequencies.
|
|
||||||
*/
|
*/
|
||||||
public void setFrequency(int frequency);
|
public void setFrequency(int frequency);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ import java.lang.reflect.Method;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ICBM {
|
public class ICBM
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Name of the channel and mod ID.
|
* Name of the channel and mod ID.
|
||||||
*/
|
*/
|
||||||
|
@ -23,12 +24,11 @@ public class ICBM {
|
||||||
public static final String MINOR_VERSION = "@MINOR@";
|
public static final String MINOR_VERSION = "@MINOR@";
|
||||||
public static final String REVISION_VERSION = "@REVIS@";
|
public static final String REVISION_VERSION = "@REVIS@";
|
||||||
public static final String BUILD_VERSION = "@BUILD@";
|
public static final String BUILD_VERSION = "@BUILD@";
|
||||||
public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION
|
public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + REVISION_VERSION;
|
||||||
+ "." + REVISION_VERSION;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The block ID in which ICBM starts with. ICBM Explosion will count up,
|
* The block ID in which ICBM starts with. ICBM Explosion will count up, ICBM Contraption will
|
||||||
* ICBM Contraption will count down.
|
* count down.
|
||||||
*/
|
*/
|
||||||
public static final int BLOCK_ID_PREFIX = 3880;
|
public static final int BLOCK_ID_PREFIX = 3880;
|
||||||
|
|
||||||
|
@ -42,15 +42,18 @@ public class ICBM {
|
||||||
/**
|
/**
|
||||||
* @return Gets an explosive object based on the name of the explosive.
|
* @return Gets an explosive object based on the name of the explosive.
|
||||||
*/
|
*/
|
||||||
public static IExplosive getExplosive(String name) {
|
public static IExplosive getExplosive(String name)
|
||||||
if (name != null) {
|
{
|
||||||
try {
|
if (name != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
Method method = explosionManager.getMethod("get", String.class);
|
Method method = explosionManager.getMethod("get", String.class);
|
||||||
return (IExplosive) method.invoke(null, name);
|
return (IExplosive) method.invoke(null, name);
|
||||||
} catch (Exception e) {
|
}
|
||||||
System.out
|
catch (Exception e)
|
||||||
.println("ICBM: Failed to get explosive with the name: "
|
{
|
||||||
+ name);
|
System.out.println("ICBM: Failed to get explosive with the name: " + name);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package icbm.api;
|
package icbm.api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applied to all blocks that can be used as a camouflage for the camouflage
|
* Applied to all blocks that can be used as a camouflage for the camouflage block. Use this
|
||||||
* block. Use this interface if your block is not a normal block but yet would
|
* interface if your block is not a normal block but yet would like it to be used as a camouflage
|
||||||
* like it to be used as a camouflage material.
|
* material.
|
||||||
*
|
*
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface ICamouflageMaterial {
|
public interface ICamouflageMaterial
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@ package icbm.api;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
public interface IHackable {
|
public interface IHackable
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Causes the machine to generate a new pass key
|
* Causes the machine to generate a new pass key
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,10 +8,10 @@ import net.minecraft.item.ItemStack;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface IItemFrequency {
|
public interface IItemFrequency
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @param data
|
* @param data - Pass an ItemStack if dealing with items with frequencies.
|
||||||
* - Pass an ItemStack if dealing with items with frequencies.
|
|
||||||
* @return The frequency of this object.
|
* @return The frequency of this object.
|
||||||
*/
|
*/
|
||||||
public int getFrequency(ItemStack itemStack);
|
public int getFrequency(ItemStack itemStack);
|
||||||
|
@ -19,10 +19,8 @@ public interface IItemFrequency {
|
||||||
/**
|
/**
|
||||||
* Sets the frequency
|
* Sets the frequency
|
||||||
*
|
*
|
||||||
* @param frequency
|
* @param frequency - The frequency of this object.
|
||||||
* - The frequency of this object.
|
* @param data - Pass an ItemStack if dealing with items with frequencies.
|
||||||
* @param data
|
|
||||||
* - Pass an ItemStack if dealing with items with frequencies.
|
|
||||||
*/
|
*/
|
||||||
public void setFrequency(int frequency, ItemStack itemStack);
|
public void setFrequency(int frequency, ItemStack itemStack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ package icbm.api;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface ILauncherContainer {
|
public interface ILauncherContainer
|
||||||
|
{
|
||||||
public IMissile getContainingMissile();
|
public IMissile getContainingMissile();
|
||||||
|
|
||||||
public void setContainingMissile(IMissile missile);
|
public void setContainingMissile(IMissile missile);
|
||||||
|
|
|
@ -5,13 +5,12 @@ import universalelectricity.core.block.IElectricalStorage;
|
||||||
import universalelectricity.core.vector.Vector3;
|
import universalelectricity.core.vector.Vector3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applied to all launcher TileEntitiies that operates the launching of
|
* Applied to all launcher TileEntitiies that operates the launching of missiles.
|
||||||
* missiles.
|
|
||||||
*
|
*
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*/
|
*/
|
||||||
public interface ILauncherController extends IElectricalStorage,
|
public interface ILauncherController extends IElectricalStorage, IBlockFrequency
|
||||||
IBlockFrequency {
|
{
|
||||||
/**
|
/**
|
||||||
* What type of launcher is this?
|
* What type of launcher is this?
|
||||||
*/
|
*/
|
||||||
|
@ -38,8 +37,7 @@ public interface ILauncherController extends IElectricalStorage,
|
||||||
public Vector3 getTarget();
|
public Vector3 getTarget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param target
|
* @param target Sets the target of the launcher
|
||||||
* Sets the target of the launcher
|
|
||||||
*/
|
*/
|
||||||
public void setTarget(Vector3 target);
|
public void setTarget(Vector3 target);
|
||||||
|
|
||||||
|
|
|
@ -4,25 +4,23 @@ import icbm.api.explosion.IExplosiveContainer;
|
||||||
import universalelectricity.core.vector.Vector3;
|
import universalelectricity.core.vector.Vector3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is an interface applied by all missile entities. You may cast this into
|
* This is an interface applied by all missile entities. You may cast this into an @Entity. The
|
||||||
* an @Entity. The "set" version of the function will make the entity do the
|
* "set" version of the function will make the entity do the action on the next tick.
|
||||||
* action on the next tick.
|
|
||||||
*
|
*
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*/
|
*/
|
||||||
public interface IMissile extends IExplosiveContainer {
|
public interface IMissile extends IExplosiveContainer
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Blows up this missile. It will detonate the missile with the appropriate
|
* Blows up this missile. It will detonate the missile with the appropriate explosion.
|
||||||
* explosion.
|
|
||||||
*/
|
*/
|
||||||
public void explode();
|
public void explode();
|
||||||
|
|
||||||
public void setExplode();
|
public void setExplode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blows up this missile like a TNT explosion. Small explosion used for
|
* Blows up this missile like a TNT explosion. Small explosion used for events such as a missile
|
||||||
* events such as a missile crashing or failure to explode will result in
|
* crashing or failure to explode will result in this function being called.
|
||||||
* this function being called.
|
|
||||||
*/
|
*/
|
||||||
public void normalExplode();
|
public void normalExplode();
|
||||||
|
|
||||||
|
@ -34,8 +32,8 @@ public interface IMissile extends IExplosiveContainer {
|
||||||
public void dropMissileAsItem();
|
public void dropMissileAsItem();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of ticks this missile has been flying for. Returns -1 if the
|
* The amount of ticks this missile has been flying for. Returns -1 if the missile is not
|
||||||
* missile is not flying.
|
* flying.
|
||||||
*/
|
*/
|
||||||
public int getTicksInAir();
|
public int getTicksInAir();
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@ package icbm.api;
|
||||||
import universalelectricity.core.vector.Vector3;
|
import universalelectricity.core.vector.Vector3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement this to your entity if you want antiballistic missiles to be able
|
* Implement this to your entity if you want antiballistic missiles to be able to lock onto it.
|
||||||
* to lock onto it.
|
|
||||||
*
|
*
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IMissileLockable {
|
public interface IMissileLockable
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Can this entity be locked on by a missile?
|
* Can this entity be locked on by a missile?
|
||||||
*
|
*
|
||||||
|
@ -18,13 +18,10 @@ public interface IMissileLockable {
|
||||||
public boolean canLock(IMissile missile);
|
public boolean canLock(IMissile missile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the predicted position of this entity after a specified amount of
|
* Gets the predicted position of this entity after a specified amount of ticks.
|
||||||
* ticks.
|
|
||||||
*
|
*
|
||||||
* @param ticks
|
* @param ticks - The amount of time.
|
||||||
* - The amount of time.
|
* @return The predicted Vector, or if not predictable, the current position.
|
||||||
* @return The predicted Vector, or if not predictable, the current
|
|
||||||
* position.
|
|
||||||
*/
|
*/
|
||||||
public Vector3 getPredictedPosition(int ticks);
|
public Vector3 getPredictedPosition(int ticks);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ package icbm.api;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface ITier {
|
public interface ITier
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Gets the tier of this object
|
* Gets the tier of this object
|
||||||
*
|
*
|
||||||
|
@ -17,8 +18,7 @@ public interface ITier {
|
||||||
/**
|
/**
|
||||||
* Sets the tier of the object
|
* Sets the tier of the object
|
||||||
*
|
*
|
||||||
* @param tier
|
* @param tier - The tier to be set
|
||||||
* - The tier to be set
|
|
||||||
*/
|
*/
|
||||||
public void setTier(int tier);
|
public void setTier(int tier);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,8 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public interface ITracker {
|
public interface ITracker
|
||||||
|
{
|
||||||
public void setTrackingEntity(ItemStack itemStack, Entity entity);
|
public void setTrackingEntity(ItemStack itemStack, Entity entity);
|
||||||
|
|
||||||
public Entity getTrackingEntity(World worldObj, ItemStack itemStack);
|
public Entity getTrackingEntity(World worldObj, ItemStack itemStack);
|
||||||
|
|
|
@ -6,6 +6,7 @@ package icbm.api;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum LauncherType {
|
public enum LauncherType
|
||||||
|
{
|
||||||
TRADITIONAL, CRUISE
|
TRADITIONAL, CRUISE
|
||||||
}
|
}
|
150
APIs/icbm/api/RadarRegistry.java
Normal file
150
APIs/icbm/api/RadarRegistry.java
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
package icbm.api;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import universalelectricity.core.vector.Vector2;
|
||||||
|
import universalelectricity.core.vector.Vector3;
|
||||||
|
import universalelectricity.prefab.vector.Region2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class allows you to register TileEntities and Entities to be detectable by the ICBM radar.
|
||||||
|
*
|
||||||
|
* Make sure you unregister your object when it invalidates!
|
||||||
|
*
|
||||||
|
* @author Calclavia
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RadarRegistry
|
||||||
|
{
|
||||||
|
private static Set<TileEntity> detectableTileEntities = new HashSet<TileEntity>();
|
||||||
|
private static Set<Entity> detectableEntities = new HashSet<Entity>();
|
||||||
|
|
||||||
|
public static void register(TileEntity tileEntity)
|
||||||
|
{
|
||||||
|
if (!detectableTileEntities.contains(tileEntity))
|
||||||
|
{
|
||||||
|
detectableTileEntities.add(tileEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void unregister(TileEntity tileEntity)
|
||||||
|
{
|
||||||
|
if (detectableTileEntities.contains(tileEntity))
|
||||||
|
{
|
||||||
|
detectableTileEntities.remove(tileEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register(Entity entity)
|
||||||
|
{
|
||||||
|
if (!detectableEntities.contains(entity))
|
||||||
|
{
|
||||||
|
detectableEntities.add(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void unregister(Entity entity)
|
||||||
|
{
|
||||||
|
if (detectableEntities.contains(entity))
|
||||||
|
{
|
||||||
|
detectableEntities.remove(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<TileEntity> getTileEntitiesInArea(Vector2 minVector, Vector2 maxVector)
|
||||||
|
{
|
||||||
|
cleanUpArray();
|
||||||
|
List<TileEntity> returnArray = new ArrayList<TileEntity>();
|
||||||
|
|
||||||
|
for (TileEntity tileEntity : detectableTileEntities)
|
||||||
|
{
|
||||||
|
if (new Region2(minVector, maxVector).isIn(new Vector3(tileEntity).toVector2()))
|
||||||
|
{
|
||||||
|
returnArray.add(tileEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Entity> getEntitiesWithinRadius(Vector2 vector, int radius)
|
||||||
|
{
|
||||||
|
cleanUpArray();
|
||||||
|
List<Entity> returnArray = new ArrayList<Entity>();
|
||||||
|
|
||||||
|
for (Entity entity : detectableEntities)
|
||||||
|
{
|
||||||
|
if (Vector2.distance(vector, new Vector3(entity).toVector2()) <= radius)
|
||||||
|
{
|
||||||
|
returnArray.add(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Set<TileEntity> getTileEntities()
|
||||||
|
{
|
||||||
|
cleanUpArray();
|
||||||
|
return detectableTileEntities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Set<Entity> getEntities()
|
||||||
|
{
|
||||||
|
cleanUpArray();
|
||||||
|
return detectableEntities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void cleanUpArray()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Iterator<TileEntity> it = detectableTileEntities.iterator();
|
||||||
|
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
TileEntity tileEntity = it.next();
|
||||||
|
|
||||||
|
if (tileEntity == null)
|
||||||
|
{
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
else if (tileEntity.isInvalid())
|
||||||
|
{
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
else if (tileEntity.worldObj.getBlockTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord) != tileEntity)
|
||||||
|
{
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator<Entity> it2 = detectableEntities.iterator();
|
||||||
|
|
||||||
|
while (it2.hasNext())
|
||||||
|
{
|
||||||
|
Entity entity = it2.next();
|
||||||
|
|
||||||
|
if (entity == null)
|
||||||
|
{
|
||||||
|
it2.remove();
|
||||||
|
}
|
||||||
|
else if (entity.isDead)
|
||||||
|
{
|
||||||
|
it2.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.out.println("Failed to clean up radar list properly.");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,18 +7,18 @@ import net.minecraftforge.event.Cancelable;
|
||||||
import net.minecraftforge.event.Event;
|
import net.minecraftforge.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use ForgeSubscribe to subscribe to this event. This event is called every
|
* Use ForgeSubscribe to subscribe to this event. This event is called every single time when an
|
||||||
* single time when an ICBM explosion happens.
|
* ICBM explosion happens.
|
||||||
*
|
*
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public class ExplosionEvent extends Event {
|
public class ExplosionEvent extends Event
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* The explosion object. Can be cast into {@link Explosion}. This event can
|
* The explosion object. Can be cast into {@link Explosion}. This event can be canceled to
|
||||||
* be canceled to prevent a specific part of an explosion from being
|
* prevent a specific part of an explosion from being executed.
|
||||||
* executed.
|
|
||||||
*/
|
*/
|
||||||
public World world;
|
public World world;
|
||||||
public double x, y, z;
|
public double x, y, z;
|
||||||
|
@ -29,7 +29,8 @@ public class ExplosionEvent extends Event {
|
||||||
*/
|
*/
|
||||||
public Explosion explosion;
|
public Explosion explosion;
|
||||||
|
|
||||||
public ExplosionEvent(World world, IExplosion iExplosion) {
|
public ExplosionEvent(World world, IExplosion iExplosion)
|
||||||
|
{
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.iExplosion = iExplosion;
|
this.iExplosion = iExplosion;
|
||||||
this.x = ((Explosion) iExplosion).explosionX;
|
this.x = ((Explosion) iExplosion).explosionX;
|
||||||
|
@ -38,15 +39,16 @@ public class ExplosionEvent extends Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before an explosive is detonated to check if detonation is
|
* Called before an explosive is detonated to check if detonation is possible. You may cancel
|
||||||
* possible. You may cancel and explosion here if needed. After this it will
|
* and explosion here if needed. After this it will be a bit too late to prevent destruction
|
||||||
* be a bit too late to prevent destruction without any losses.
|
* without any losses.
|
||||||
*
|
*
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class ExplosivePreDetonationEvent extends Event {
|
public static class ExplosivePreDetonationEvent extends Event
|
||||||
|
{
|
||||||
public World world;
|
public World world;
|
||||||
public Entity entity;
|
public Entity entity;
|
||||||
public double x, y, z;
|
public double x, y, z;
|
||||||
|
@ -54,15 +56,15 @@ public class ExplosionEvent extends Event {
|
||||||
public IExplosive explosion;
|
public IExplosive explosion;
|
||||||
public ExplosiveType type;
|
public ExplosiveType type;
|
||||||
|
|
||||||
public ExplosivePreDetonationEvent(World world, double x, double y,
|
public ExplosivePreDetonationEvent(World world, double x, double y, double z, ExplosiveType type, IExplosive explosion)
|
||||||
double z, ExplosiveType type, IExplosive explosion) {
|
{
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.explosion = explosion;
|
this.explosion = explosion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExplosivePreDetonationEvent(World world, Entity entity,
|
public ExplosivePreDetonationEvent(World world, Entity entity, ExplosiveType type, IExplosive explosion)
|
||||||
ExplosiveType type, IExplosive explosion) {
|
{
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.entity = entity;
|
this.entity = entity;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
@ -76,8 +78,10 @@ public class ExplosionEvent extends Event {
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static class ExplosionConstructionEvent extends ExplosionEvent {
|
public static class ExplosionConstructionEvent extends ExplosionEvent
|
||||||
public ExplosionConstructionEvent(World world, IExplosion explosion) {
|
{
|
||||||
|
public ExplosionConstructionEvent(World world, IExplosion explosion)
|
||||||
|
{
|
||||||
super(world, explosion);
|
super(world, explosion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,21 +92,25 @@ public class ExplosionEvent extends Event {
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static class PreExplosionEvent extends ExplosionEvent {
|
public static class PreExplosionEvent extends ExplosionEvent
|
||||||
public PreExplosionEvent(World world, IExplosion explosion) {
|
{
|
||||||
|
public PreExplosionEvent(World world, IExplosion explosion)
|
||||||
|
{
|
||||||
super(world, explosion);
|
super(world, explosion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called while an explosion happens. May be called every single tick if
|
* Called while an explosion happens. May be called every single tick if explosion is
|
||||||
* explosion is procedural. (E.g: Red matter explosive)
|
* procedural. (E.g: Red matter explosive)
|
||||||
*
|
*
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static class DoExplosionEvent extends ExplosionEvent {
|
public static class DoExplosionEvent extends ExplosionEvent
|
||||||
public DoExplosionEvent(World world, IExplosion explosion) {
|
{
|
||||||
|
public DoExplosionEvent(World world, IExplosion explosion)
|
||||||
|
{
|
||||||
super(world, explosion);
|
super(world, explosion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,8 +121,10 @@ public class ExplosionEvent extends Event {
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static class PostExplosionEvent extends ExplosionEvent {
|
public static class PostExplosionEvent extends ExplosionEvent
|
||||||
public PostExplosionEvent(World world, IExplosion explosion) {
|
{
|
||||||
|
public PostExplosionEvent(World world, IExplosion explosion)
|
||||||
|
{
|
||||||
super(world, explosion);
|
super(world, explosion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package icbm.api.explosion;
|
package icbm.api.explosion;
|
||||||
|
|
||||||
public enum ExplosiveType {
|
public enum ExplosiveType
|
||||||
|
{
|
||||||
ALL,
|
ALL,
|
||||||
/** An explosive in TNT block form. */
|
/** An explosive in TNT block form. */
|
||||||
BLOCK,
|
BLOCK,
|
||||||
|
@ -11,8 +12,10 @@ public enum ExplosiveType {
|
||||||
/** An explosive in vehicle form such as a minecart. */
|
/** An explosive in vehicle form such as a minecart. */
|
||||||
VEHICLE;
|
VEHICLE;
|
||||||
|
|
||||||
public static ExplosiveType get(int id) {
|
public static ExplosiveType get(int id)
|
||||||
if (id >= 0 && id < ExplosiveType.values().length) {
|
{
|
||||||
|
if (id >= 0 && id < ExplosiveType.values().length)
|
||||||
|
{
|
||||||
return ExplosiveType.values()[id];
|
return ExplosiveType.values()[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,22 +4,19 @@ import net.minecraft.world.World;
|
||||||
import universalelectricity.core.vector.Vector3;
|
import universalelectricity.core.vector.Vector3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applied to all blocks that has a custom reaction to EMPs. Blocks not
|
* Applied to all blocks that has a custom reaction to EMPs. Blocks not TileEntities.
|
||||||
* TileEntities.
|
|
||||||
*
|
*
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IEMPBlock {
|
public interface IEMPBlock
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Called when this block gets attacked by EMP.
|
* Called when this block gets attacked by EMP.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world - The world object.
|
||||||
* - The world object.
|
* @param position - The position.
|
||||||
* @param position
|
* @param empExplosive - The explosion
|
||||||
* - The position.
|
|
||||||
* @param empExplosive
|
|
||||||
* - The explosion
|
|
||||||
*/
|
*/
|
||||||
public void onEMP(World world, Vector3 position, IExplosion empExplosive);
|
public void onEMP(World world, Vector3 position, IExplosion empExplosive);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,17 +10,14 @@ import universalelectricity.core.item.IItemElectric;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IEMPItem extends IItemElectric {
|
public interface IEMPItem extends IItemElectric
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Called when this item is being EMPed
|
* Called when this item is being EMPed
|
||||||
*
|
*
|
||||||
* @param itemStack
|
* @param itemStack - The itemstack attacked by EMP
|
||||||
* - The itemstack attacked by EMP
|
* @param entity - The entity holding the item
|
||||||
* @param entity
|
* @param empExplosives - The IExplosive object
|
||||||
* - The entity holding the item
|
|
||||||
* @param empExplosives
|
|
||||||
* - The IExplosive object
|
|
||||||
*/
|
*/
|
||||||
public void onEMP(ItemStack itemStack, Entity entity,
|
public void onEMP(ItemStack itemStack, Entity entity, IExplosion empExplosive);
|
||||||
IExplosion empExplosive);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ package icbm.api.explosion;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IExplosion {
|
public interface IExplosion
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Called to initiate the explosion.
|
* Called to initiate the explosion.
|
||||||
*/
|
*/
|
||||||
|
@ -18,8 +19,8 @@ public interface IExplosion {
|
||||||
public float getRadius();
|
public float getRadius();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The energy emitted by this explosive. In Joules and approximately
|
* @return The energy emitted by this explosive. In Joules and approximately based off of a real
|
||||||
* based off of a real life equivalent.
|
* life equivalent.
|
||||||
*/
|
*/
|
||||||
public float getEnergy();
|
public float getEnergy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ import net.minecraft.world.World;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IExplosive extends ITier {
|
public interface IExplosive extends ITier
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @return Gets the explosive's ID.
|
* @return Gets the explosive's ID.
|
||||||
*/
|
*/
|
||||||
|
@ -22,26 +23,22 @@ public interface IExplosive extends ITier {
|
||||||
public String getUnlocalizedName();
|
public String getUnlocalizedName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Gets the specific translated name of the block versions of the
|
* @return Gets the specific translated name of the block versions of the explosive.
|
||||||
* explosive.
|
|
||||||
*/
|
*/
|
||||||
public String getExplosiveName();
|
public String getExplosiveName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Gets the specific translated name of the grenade versions of the
|
* @return Gets the specific translated name of the grenade versions of the explosive.
|
||||||
* explosive.
|
|
||||||
*/
|
*/
|
||||||
public String getGrenadeName();
|
public String getGrenadeName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Gets the specific translated name of the missile versions of the
|
* @return Gets the specific translated name of the missile versions of the explosive.
|
||||||
* explosive.
|
|
||||||
*/
|
*/
|
||||||
public String getMissileName();
|
public String getMissileName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Gets the specific translated name of the minecart versions of the
|
* @return Gets the specific translated name of the minecart versions of the explosive.
|
||||||
* explosive.
|
|
||||||
*/
|
*/
|
||||||
public String getMinecartName();
|
public String getMinecartName();
|
||||||
|
|
||||||
|
@ -54,17 +51,11 @@ public interface IExplosive extends ITier {
|
||||||
/**
|
/**
|
||||||
* Creates a new explosion at a given location.
|
* Creates a new explosion at a given location.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world The world in which the explosion takes place.
|
||||||
* The world in which the explosion takes place.
|
* @param x The X-Coord
|
||||||
* @param x
|
* @param y The Y-Coord
|
||||||
* The X-Coord
|
* @param z The Z-Coord
|
||||||
* @param y
|
* @param entity Entity that caused the explosion.
|
||||||
* The Y-Coord
|
|
||||||
* @param z
|
|
||||||
* The Z-Coord
|
|
||||||
* @param entity
|
|
||||||
* Entity that caused the explosion.
|
|
||||||
*/
|
*/
|
||||||
public void createExplosion(World world, double x, double y, double z,
|
public void createExplosion(World world, double x, double y, double z, Entity entity);
|
||||||
Entity entity);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,14 @@ package icbm.api.explosion;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An object that contains a reference to IExplosive. Carried by explosives,
|
* An object that contains a reference to IExplosive. Carried by explosives, grenades and missile
|
||||||
* grenades and missile entities etc.
|
* entities etc.
|
||||||
*
|
*
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IExplosiveContainer {
|
public interface IExplosiveContainer
|
||||||
|
{
|
||||||
public NBTTagCompound getTagCompound();
|
public NBTTagCompound getTagCompound();
|
||||||
|
|
||||||
public IExplosive getExplosiveType();
|
public IExplosive getExplosiveType();
|
||||||
|
|
|
@ -6,6 +6,7 @@ package icbm.api.explosion;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IExplosiveIgnore {
|
public interface IExplosiveIgnore
|
||||||
|
{
|
||||||
public boolean canIgnore(IExplosion explosion);
|
public boolean canIgnore(IExplosion explosion);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,32 +6,28 @@ package icbm.api.sentry;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IAATarget {
|
public interface IAATarget
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* destroys the target with a boom. This is a forced way for the sentry too
|
* destroys the target with a boom. This is a forced way for the sentry too kill the target if
|
||||||
* kill the target if it doesn't take damage
|
* it doesn't take damage
|
||||||
*/
|
*/
|
||||||
public void destroyCraft();
|
public void destroyCraft();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies damage to the the target
|
* Applies damage to the the target
|
||||||
*
|
*
|
||||||
* @param damage
|
* @param damage - damage in half HP
|
||||||
* - damage in half HP
|
* @return the amount of HP left. Return -1 if this target can't take damage, and will be chance
|
||||||
* @return the amount of HP left. Return -1 if this target can't take
|
* killed. Return 0 if this target is dead and destroyCraft() will be called.
|
||||||
* damage, and will be chance killed. Return 0 if this target is
|
|
||||||
* dead and destroyCraft() will be called.
|
|
||||||
*/
|
*/
|
||||||
public int doDamage(int damage);
|
public int doDamage(int damage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can this be targeted by automated targeting systems or AIs. Used to
|
* Can this be targeted by automated targeting systems or AIs. Used to implement radar jammers,
|
||||||
* implement radar jammers, cloaking devices, and other addons for the
|
* cloaking devices, and other addons for the Entity being targeted
|
||||||
* Entity being targeted
|
|
||||||
*
|
*
|
||||||
* @param entity
|
* @param entity - entity that is targeting this, can be an Entity, EntityLiving, or TileEntity
|
||||||
* - entity that is targeting this, can be an Entity,
|
|
||||||
* EntityLiving, or TileEntity
|
|
||||||
* @return true if it can
|
* @return true if it can
|
||||||
*/
|
*/
|
||||||
public boolean canBeTargeted(Object entity);
|
public boolean canBeTargeted(Object entity);
|
||||||
|
|
Loading…
Reference in a new issue