mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
small fluid tweaks, HIMARS rocket item class, cargo arty shell
This commit is contained in:
parent
8130b62821
commit
37ff82ee16
@ -140,109 +140,125 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
} else {
|
||||||
|
|
||||||
this.inGround = false;
|
this.inGround = false;
|
||||||
this.motionX *= (double) (this.rand.nextFloat() * 0.2F);
|
this.motionX *= (double) (this.rand.nextFloat() * 0.2F);
|
||||||
this.motionY *= (double) (this.rand.nextFloat() * 0.2F);
|
this.motionY *= (double) (this.rand.nextFloat() * 0.2F);
|
||||||
this.motionZ *= (double) (this.rand.nextFloat() * 0.2F);
|
this.motionZ *= (double) (this.rand.nextFloat() * 0.2F);
|
||||||
this.ticksInGround = 0;
|
this.ticksInGround = 0;
|
||||||
this.ticksInAir = 0;
|
this.ticksInAir = 0;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
++this.ticksInAir;
|
++this.ticksInAir;
|
||||||
}
|
|
||||||
|
Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||||
Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
Vec3 nextPos = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||||
Vec3 nextPos = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos);
|
||||||
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos);
|
pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
||||||
pos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
|
nextPos = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
||||||
nextPos = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
|
|
||||||
|
if(mop != null) {
|
||||||
if(mop != null) {
|
nextPos = Vec3.createVectorHelper(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||||
nextPos = Vec3.createVectorHelper(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
}
|
||||||
}
|
|
||||||
|
if(!this.worldObj.isRemote) {
|
||||||
if(!this.worldObj.isRemote) {
|
|
||||||
|
Entity hitEntity = null;
|
||||||
Entity hitEntity = null;
|
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
||||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
|
double nearest = 0.0D;
|
||||||
double nearest = 0.0D;
|
EntityLivingBase thrower = this.getThrower();
|
||||||
EntityLivingBase thrower = this.getThrower();
|
|
||||||
|
for(int j = 0; j < list.size(); ++j) {
|
||||||
for(int j = 0; j < list.size(); ++j) {
|
Entity entity = (Entity) list.get(j);
|
||||||
Entity entity = (Entity) list.get(j);
|
|
||||||
|
if(entity.canBeCollidedWith() && (entity != thrower || this.ticksInAir >= 5)) {
|
||||||
if(entity.canBeCollidedWith() && (entity != thrower || this.ticksInAir >= 5)) {
|
double hitbox = 0.3F;
|
||||||
double hitbox = 0.3F;
|
AxisAlignedBB aabb = entity.boundingBox.expand(hitbox, hitbox, hitbox);
|
||||||
AxisAlignedBB aabb = entity.boundingBox.expand(hitbox, hitbox, hitbox);
|
MovingObjectPosition hitMop = aabb.calculateIntercept(pos, nextPos);
|
||||||
MovingObjectPosition hitMop = aabb.calculateIntercept(pos, nextPos);
|
|
||||||
|
if(hitMop != null) {
|
||||||
if(hitMop != null) {
|
double dist = pos.distanceTo(hitMop.hitVec);
|
||||||
double dist = pos.distanceTo(hitMop.hitVec);
|
|
||||||
|
if(dist < nearest || nearest == 0.0D) {
|
||||||
if(dist < nearest || nearest == 0.0D) {
|
hitEntity = entity;
|
||||||
hitEntity = entity;
|
nearest = dist;
|
||||||
nearest = dist;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hitEntity != null) {
|
||||||
|
mop = new MovingObjectPosition(hitEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hitEntity != null) {
|
if(mop != null) {
|
||||||
mop = new MovingObjectPosition(hitEntity);
|
if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ) == Blocks.portal) {
|
||||||
|
this.setInPortal();
|
||||||
|
} else {
|
||||||
|
this.onImpact(mop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
this.posX += this.motionX;
|
||||||
if(mop != null) {
|
this.posY += this.motionY;
|
||||||
if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ) == Blocks.portal) {
|
this.posZ += this.motionZ;
|
||||||
this.setInPortal();
|
|
||||||
} else {
|
float hyp = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||||
this.onImpact(mop);
|
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
||||||
|
|
||||||
|
for(this.rotationPitch = (float) (Math.atan2(this.motionY, (double) hyp) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
while(this.rotationPitch - this.prevRotationPitch >= 180.0F) {
|
||||||
this.posX += this.motionX;
|
this.prevRotationPitch += 360.0F;
|
||||||
this.posY += this.motionY;
|
|
||||||
this.posZ += this.motionZ;
|
|
||||||
|
|
||||||
float hyp = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
|
||||||
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
|
|
||||||
|
|
||||||
for(this.rotationPitch = (float) (Math.atan2(this.motionY, (double) hyp) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(this.rotationPitch - this.prevRotationPitch >= 180.0F) {
|
|
||||||
this.prevRotationPitch += 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(this.rotationYaw - this.prevRotationYaw < -180.0F) {
|
|
||||||
this.prevRotationYaw -= 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(this.rotationYaw - this.prevRotationYaw >= 180.0F) {
|
|
||||||
this.prevRotationYaw += 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
|
|
||||||
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
|
|
||||||
float drag = this.getAirDrag();
|
|
||||||
double gravity = this.getGravityVelocity();
|
|
||||||
|
|
||||||
if(this.isInWater()) {
|
|
||||||
for(int i = 0; i < 4; ++i) {
|
|
||||||
float f = 0.25F;
|
|
||||||
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double) f, this.posY - this.motionY * (double) f, this.posZ - this.motionZ * (double) f, this.motionX, this.motionY, this.motionZ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while(this.rotationYaw - this.prevRotationYaw < -180.0F) {
|
||||||
|
this.prevRotationYaw -= 360.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(this.rotationYaw - this.prevRotationYaw >= 180.0F) {
|
||||||
|
this.prevRotationYaw += 360.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
|
||||||
|
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
|
||||||
|
float drag = this.getAirDrag();
|
||||||
|
double gravity = this.getGravityVelocity();
|
||||||
|
|
||||||
|
if(this.isInWater()) {
|
||||||
|
for(int i = 0; i < 4; ++i) {
|
||||||
|
float f = 0.25F;
|
||||||
|
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double) f, this.posY - this.motionY * (double) f, this.posZ - this.motionZ * (double) f, this.motionX, this.motionY, this.motionZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
drag = this.getWaterDrag();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.motionX *= (double) drag;
|
||||||
|
this.motionY *= (double) drag;
|
||||||
|
this.motionZ *= (double) drag;
|
||||||
|
this.motionY -= gravity;
|
||||||
|
this.setPosition(this.posX, this.posY, this.posZ);
|
||||||
|
|
||||||
drag = this.getWaterDrag();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.motionX *= (double) drag;
|
|
||||||
this.motionY *= (double) drag;
|
public boolean alowMultiImpact() {
|
||||||
this.motionZ *= (double) drag;
|
return false; //TODO
|
||||||
this.motionY -= gravity;
|
}
|
||||||
this.setPosition(this.posX, this.posY, this.posZ);
|
|
||||||
|
public void getStuck(int x, int y, int z) {
|
||||||
|
this.stuckBlockX = x;
|
||||||
|
this.stuckBlockY = y;
|
||||||
|
this.stuckBlockZ = z;
|
||||||
|
this.stuckBlock = worldObj.getBlock(x, y, z);
|
||||||
|
this.inGround = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getGravityVelocity() {
|
public double getGravityVelocity() {
|
||||||
|
|||||||
@ -324,6 +324,9 @@ public class Fluids {
|
|||||||
|
|
||||||
OIL.addTraits(new FT_Heatable().setEff(HeatingType.BOILER, 1.0D).setEff(HeatingType.HEATEXCHANGER, 1.0D).addStep(10, 1, HOTOIL, 1));
|
OIL.addTraits(new FT_Heatable().setEff(HeatingType.BOILER, 1.0D).setEff(HeatingType.HEATEXCHANGER, 1.0D).addStep(10, 1, HOTOIL, 1));
|
||||||
CRACKOIL.addTraits(new FT_Heatable().setEff(HeatingType.BOILER, 1.0D).setEff(HeatingType.HEATEXCHANGER, 1.0D).addStep(10, 1, HOTCRACKOIL, 1));
|
CRACKOIL.addTraits(new FT_Heatable().setEff(HeatingType.BOILER, 1.0D).setEff(HeatingType.HEATEXCHANGER, 1.0D).addStep(10, 1, HOTCRACKOIL, 1));
|
||||||
|
|
||||||
|
HOTOIL.addTraits(new FT_Coolable(OIL, 1, 1, 10).setEff(CoolingType.HEATEXCHANGER, 1.0D));
|
||||||
|
HOTCRACKOIL.addTraits(new FT_Coolable(CRACKOIL, 1, 1, 10).setEff(CoolingType.HEATEXCHANGER, 1.0D));
|
||||||
|
|
||||||
if(idMapping.size() != metaOrder.size()) {
|
if(idMapping.size() != metaOrder.size()) {
|
||||||
throw new IllegalStateException("A severe error has occoured during NTM's fluid registering process! The MetaOrder and Mappings are inconsistent! Mapping size: " + idMapping.size()+ " / MetaOrder size: " + metaOrder.size());
|
throw new IllegalStateException("A severe error has occoured during NTM's fluid registering process! The MetaOrder and Mappings are inconsistent! Mapping size: " + idMapping.size()+ " / MetaOrder size: " + metaOrder.size());
|
||||||
|
|||||||
@ -1587,6 +1587,7 @@ public class ModItems {
|
|||||||
public static Item ammo_shell_w9;
|
public static Item ammo_shell_w9;
|
||||||
public static Item ammo_dgk;
|
public static Item ammo_dgk;
|
||||||
public static Item ammo_arty;
|
public static Item ammo_arty;
|
||||||
|
public static Item ammo_himars;
|
||||||
public static Item ammo_nuke;
|
public static Item ammo_nuke;
|
||||||
public static Item ammo_nuke_low;
|
public static Item ammo_nuke_low;
|
||||||
public static Item ammo_nuke_high;
|
public static Item ammo_nuke_high;
|
||||||
@ -4340,6 +4341,7 @@ public class ModItems {
|
|||||||
ammo_shell_w9 = new ItemAmmo().setUnlocalizedName("ammo_shell_w9");
|
ammo_shell_w9 = new ItemAmmo().setUnlocalizedName("ammo_shell_w9");
|
||||||
ammo_dgk = new ItemAmmo().setUnlocalizedName("ammo_dgk");
|
ammo_dgk = new ItemAmmo().setUnlocalizedName("ammo_dgk");
|
||||||
ammo_arty = new ItemAmmoArty().setUnlocalizedName("ammo_arty");
|
ammo_arty = new ItemAmmoArty().setUnlocalizedName("ammo_arty");
|
||||||
|
ammo_himars = new ItemAmmoHIMARS().setUnlocalizedName("ammo_himars");
|
||||||
ammo_nuke = new ItemAmmo().setUnlocalizedName("ammo_nuke");
|
ammo_nuke = new ItemAmmo().setUnlocalizedName("ammo_nuke");
|
||||||
ammo_nuke_low = new ItemAmmo().setUnlocalizedName("ammo_nuke_low");
|
ammo_nuke_low = new ItemAmmo().setUnlocalizedName("ammo_nuke_low");
|
||||||
ammo_nuke_high = new ItemAmmo().setUnlocalizedName("ammo_nuke_high");
|
ammo_nuke_high = new ItemAmmo().setUnlocalizedName("ammo_nuke_high");
|
||||||
@ -7441,6 +7443,7 @@ public class ModItems {
|
|||||||
GameRegistry.registerItem(ammo_shell_w9, ammo_shell_w9.getUnlocalizedName());
|
GameRegistry.registerItem(ammo_shell_w9, ammo_shell_w9.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(ammo_dgk, ammo_dgk.getUnlocalizedName());
|
GameRegistry.registerItem(ammo_dgk, ammo_dgk.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(ammo_arty, ammo_arty.getUnlocalizedName());
|
GameRegistry.registerItem(ammo_arty, ammo_arty.getUnlocalizedName());
|
||||||
|
GameRegistry.registerItem(ammo_himars, ammo_himars.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(ammo_nuke, ammo_nuke.getUnlocalizedName());
|
GameRegistry.registerItem(ammo_nuke, ammo_nuke.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(ammo_nuke_low, ammo_nuke_low.getUnlocalizedName());
|
GameRegistry.registerItem(ammo_nuke_low, ammo_nuke_low.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(ammo_nuke_high, ammo_nuke_high.getUnlocalizedName());
|
GameRegistry.registerItem(ammo_nuke_high, ammo_nuke_high.getUnlocalizedName());
|
||||||
|
|||||||
@ -38,11 +38,12 @@ import net.minecraft.util.EnumChatFormatting;
|
|||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||||
|
|
||||||
public class ItemAmmoArty extends Item {
|
public class ItemAmmoArty extends Item {
|
||||||
|
|
||||||
public static ArtilleryShell[] itemTypes = new ArtilleryShell[ /* >>> */ 8 /* <<< */ ];
|
public static ArtilleryShell[] itemTypes = new ArtilleryShell[ /* >>> */ 9 /* <<< */ ];
|
||||||
public static ArtilleryShell[] shellTypes = new ArtilleryShell[ /* >>> */ 8 /* <<< */ ];
|
//public static ArtilleryShell[] shellTypes = new ArtilleryShell[ /* >>> */ 8 /* <<< */ ];
|
||||||
/* item types */
|
/* item types */
|
||||||
public final int NORMAL = 0;
|
public final int NORMAL = 0;
|
||||||
public final int CLASSIC = 1;
|
public final int CLASSIC = 1;
|
||||||
@ -52,6 +53,7 @@ public class ItemAmmoArty extends Item {
|
|||||||
public final int PHOSPHORUS = 5;
|
public final int PHOSPHORUS = 5;
|
||||||
public final int MINI_NUKE_MULTI = 6;
|
public final int MINI_NUKE_MULTI = 6;
|
||||||
public final int PHOSPHORUS_MULTI = 7;
|
public final int PHOSPHORUS_MULTI = 7;
|
||||||
|
public final int CARGO = 8;
|
||||||
/* non-item shell types */
|
/* non-item shell types */
|
||||||
|
|
||||||
public ItemAmmoArty() {
|
public ItemAmmoArty() {
|
||||||
@ -71,6 +73,7 @@ public class ItemAmmoArty extends Item {
|
|||||||
list.add(new ItemStack(item, 1, MINI_NUKE));
|
list.add(new ItemStack(item, 1, MINI_NUKE));
|
||||||
list.add(new ItemStack(item, 1, MINI_NUKE_MULTI));
|
list.add(new ItemStack(item, 1, MINI_NUKE_MULTI));
|
||||||
list.add(new ItemStack(item, 1, NUKE));
|
list.add(new ItemStack(item, 1, NUKE));
|
||||||
|
list.add(new ItemStack(item, 1, CARGO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -204,12 +207,12 @@ public class ItemAmmoArty extends Item {
|
|||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
/* STANDARD SHELLS */
|
/* STANDARD SHELLS */
|
||||||
this.shellTypes[NORMAL] = this.itemTypes[NORMAL] = new ArtilleryShell("ammo_arty") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 10F, 3F, false); }};
|
this.itemTypes[NORMAL] = new ArtilleryShell("ammo_arty") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 10F, 3F, false); }};
|
||||||
this.shellTypes[CLASSIC] = this.itemTypes[CLASSIC] = new ArtilleryShell("ammo_arty_classic") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 15F, 5F, false); }};
|
this.itemTypes[CLASSIC] = new ArtilleryShell("ammo_arty_classic") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 15F, 5F, false); }};
|
||||||
this.shellTypes[EXPLOSIVE] = this.itemTypes[EXPLOSIVE] = new ArtilleryShell("ammo_arty_he") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 15F, 3F, true); }};
|
this.itemTypes[EXPLOSIVE] = new ArtilleryShell("ammo_arty_he") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { standardExplosion(shell, mop, 15F, 3F, true); }};
|
||||||
|
|
||||||
/* MINI NUKE */
|
/* MINI NUKE */
|
||||||
this.shellTypes[MINI_NUKE] = this.itemTypes[MINI_NUKE] = new ArtilleryShell("ammo_arty_mini_nuke") {
|
this.itemTypes[MINI_NUKE] = new ArtilleryShell("ammo_arty_mini_nuke") {
|
||||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||||
shell.killAndClear();
|
shell.killAndClear();
|
||||||
Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize();
|
Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize();
|
||||||
@ -218,7 +221,7 @@ public class ItemAmmoArty extends Item {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* FULL NUKE */
|
/* FULL NUKE */
|
||||||
this.shellTypes[NUKE] = this.itemTypes[NUKE] = new ArtilleryShell("ammo_arty_nuke") {
|
this.itemTypes[NUKE] = new ArtilleryShell("ammo_arty_nuke") {
|
||||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||||
shell.worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(shell.worldObj, BombConfig.missileRadius, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord));
|
shell.worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(shell.worldObj, BombConfig.missileRadius, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord));
|
||||||
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(shell.worldObj, 1000, BombConfig.missileRadius * 0.005F);
|
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(shell.worldObj, 1000, BombConfig.missileRadius * 0.005F);
|
||||||
@ -231,7 +234,7 @@ public class ItemAmmoArty extends Item {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* PHOSPHORUS */
|
/* PHOSPHORUS */
|
||||||
this.shellTypes[PHOSPHORUS] = this.itemTypes[PHOSPHORUS] = new ArtilleryShell("ammo_arty_phosphorus") {
|
this.itemTypes[PHOSPHORUS] = new ArtilleryShell("ammo_arty_phosphorus") {
|
||||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||||
standardExplosion(shell, mop, 10F, 3F, false);
|
standardExplosion(shell, mop, 10F, 3F, false);
|
||||||
shell.worldObj.playSoundEffect(shell.posX, shell.posY, shell.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + shell.worldObj.rand.nextFloat() * 0.2F);
|
shell.worldObj.playSoundEffect(shell.posX, shell.posY, shell.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + shell.worldObj.rand.nextFloat() * 0.2F);
|
||||||
@ -259,13 +262,21 @@ public class ItemAmmoArty extends Item {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* THIS DOOFUS */
|
||||||
|
this.itemTypes[NORMAL] = new ArtilleryShell("ammo_arty_cargo") { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||||
|
if(mop.typeOfHit == MovingObjectType.BLOCK) {
|
||||||
|
shell.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||||
|
shell.getStuck(mop.blockX, mop.blockY, mop.blockZ);
|
||||||
|
}
|
||||||
|
}};
|
||||||
|
|
||||||
/* CLUSTER SHELLS */
|
/* CLUSTER SHELLS */
|
||||||
this.shellTypes[PHOSPHORUS_MULTI] = this.itemTypes[PHOSPHORUS_MULTI] = new ArtilleryShell("ammo_arty_phosphorus_multi") {
|
this.itemTypes[PHOSPHORUS_MULTI] = new ArtilleryShell("ammo_arty_phosphorus_multi") {
|
||||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { ItemAmmoArty.this.shellTypes[PHOSPHORUS].onImpact(shell, mop); }
|
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { ItemAmmoArty.this.itemTypes[PHOSPHORUS].onImpact(shell, mop); }
|
||||||
public void onUpdate(EntityArtilleryShell shell) { standardCluster(shell, PHOSPHORUS, 10, 300, 5); }
|
public void onUpdate(EntityArtilleryShell shell) { standardCluster(shell, PHOSPHORUS, 10, 300, 5); }
|
||||||
};
|
};
|
||||||
this.shellTypes[MINI_NUKE_MULTI] = this.itemTypes[MINI_NUKE_MULTI] = new ArtilleryShell("ammo_arty_mini_nuke_multi") {
|
this.itemTypes[MINI_NUKE_MULTI] = new ArtilleryShell("ammo_arty_mini_nuke_multi") {
|
||||||
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { ItemAmmoArty.this.shellTypes[MINI_NUKE].onImpact(shell, mop); }
|
public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { ItemAmmoArty.this.itemTypes[MINI_NUKE].onImpact(shell, mop); }
|
||||||
public void onUpdate(EntityArtilleryShell shell) { standardCluster(shell, MINI_NUKE, 5, 300, 5); }
|
public void onUpdate(EntityArtilleryShell shell) { standardCluster(shell, MINI_NUKE, 5, 300, 5); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
56
src/main/java/com/hbm/items/weapon/ItemAmmoHIMARS.java
Normal file
56
src/main/java/com/hbm/items/weapon/ItemAmmoHIMARS.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package com.hbm.items.weapon;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hbm.lib.RefStrings;
|
||||||
|
import com.hbm.main.MainRegistry;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
|
||||||
|
public class ItemAmmoHIMARS extends Item {
|
||||||
|
|
||||||
|
public static HIMARSRocket[] itemTypes = new HIMARSRocket[ /* >>> */ 2 /* <<< */ ];
|
||||||
|
|
||||||
|
public final int SMALL = 0;
|
||||||
|
public final int LARGE = 1;
|
||||||
|
|
||||||
|
public ItemAmmoHIMARS() {
|
||||||
|
this.setHasSubtypes(true);
|
||||||
|
this.setCreativeTab(MainRegistry.weaponTab);
|
||||||
|
this.setTextureName(RefStrings.MODID + ":ammo_rocket");
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
|
list.add(new ItemStack(item, 1, SMALL));
|
||||||
|
list.add(new ItemStack(item, 1, LARGE));
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class HIMARSRocket {
|
||||||
|
|
||||||
|
String name;
|
||||||
|
|
||||||
|
public HIMARSRocket() { }
|
||||||
|
|
||||||
|
public HIMARSRocket(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void onImpact(Entity rocket, MovingObjectPosition mop);
|
||||||
|
public void onUpdate(Entity rocket) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
/* STANDARD SHELLS */
|
||||||
|
this.itemTypes[SMALL] = new HIMARSRocket("ammo_himars") { public void onImpact(Entity rocket, MovingObjectPosition mop) { }};
|
||||||
|
this.itemTypes[LARGE] = new HIMARSRocket("ammo_himars_large") { public void onImpact(Entity rocket, MovingObjectPosition mop) { }};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -349,6 +349,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
|||||||
//the amount of material in the entire recipe input
|
//the amount of material in the entire recipe input
|
||||||
int recipeContent = recipe != null ? recipe.getInputAmount() : 0;
|
int recipeContent = recipe != null ? recipe.getInputAmount() : 0;
|
||||||
//the total amount of the current waste stack, used for simulation
|
//the total amount of the current waste stack, used for simulation
|
||||||
|
int recipeAmount = getQuantaFromType(this.recipeStack, null);
|
||||||
int wasteAmount = getQuantaFromType(this.wasteStack, null);
|
int wasteAmount = getQuantaFromType(this.wasteStack, null);
|
||||||
|
|
||||||
for(MaterialStack mat : materials) {
|
for(MaterialStack mat : materials) {
|
||||||
@ -366,14 +367,16 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
|
|||||||
|
|
||||||
matchesRecipe = true;
|
matchesRecipe = true;
|
||||||
|
|
||||||
|
recipeAmount += mat.amount;
|
||||||
|
|
||||||
//if the amount of that input would exceed the amount dictated by the recipe, return false
|
//if the amount of that input would exceed the amount dictated by the recipe, return false
|
||||||
if(recipe != null && amountStored + mat.amount > matMaximum)
|
if(recipe != null && amountStored + mat.amount > matMaximum)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if the waste amount doesn't exceed the capacity and the recipe matches (or isn't null), return true
|
//if the amount doesn't exceed the capacity and the recipe matches (or isn't null), return true
|
||||||
return wasteAmount <= this.wasteZCapacity && matchesRecipe;
|
return recipeAmount <= this.recipeZCapacity && wasteAmount <= this.wasteZCapacity && matchesRecipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToStack(List<MaterialStack> stack, MaterialStack matStack) {
|
public void addToStack(List<MaterialStack> stack, MaterialStack matStack) {
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 434 B After Width: | Height: | Size: 430 B |
BIN
src/main/resources/assets/hbm/textures/items/ammo_arty_cargo.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/ammo_arty_cargo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 311 B |
Binary file not shown.
|
After Width: | Height: | Size: 365 B |
Loading…
x
Reference in New Issue
Block a user