ported all bullet effects to the NT system

This commit is contained in:
Boblet 2023-07-14 15:09:46 +02:00
parent 5bcffadbab
commit 24a0fbffef
58 changed files with 656 additions and 2378 deletions

View File

@ -11,7 +11,6 @@ import com.hbm.util.I18nUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;

View File

@ -157,7 +157,6 @@ public class EntityMappings {
addEntity(EntityGrenadeIFHopwire.class, "entity_grenade_ironshod_hopwire", 250);
addEntity(EntityGrenadeIFNull.class, "entity_grenade_ironshod_null", 250);
addEntity(EntityFallingNuke.class, "entity_falling_bomb", 1000);
addEntity(EntityBulletBase.class, "entity_bullet_mk2", 250);
addEntity(EntityBulletBaseNT.class, "entity_bullet_mk3", 250, false);
addEntity(EntityMinerRocket.class, "entity_miner_lander", 1000);
addEntity(EntityFogFX.class, "entity_nuclear_fog", 1000);

View File

@ -6,7 +6,6 @@ import net.minecraft.world.World;
import java.util.Random;
import com.hbm.entity.effect.EntityMist;
import com.hbm.explosion.ExplosionChaos;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.ItemGrenade;

View File

@ -1,6 +1,6 @@
package com.hbm.entity.logic;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
@ -45,7 +45,7 @@ public class EntityDeathBlast extends Entity {
Vec3 vec = Vec3.createVectorHelper(0.2, 0, 0);
vec.rotateAroundY((float)(2 * Math.PI * i / (float)count));
EntityBulletBase laser = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.MASKMAN_BOLT);
EntityBulletBaseNT laser = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.MASKMAN_BOLT);
laser.setPosition(posX, posY + 2, posZ);
laser.motionX = vec.xCoord;
laser.motionZ = vec.zCoord;

View File

@ -9,7 +9,7 @@ import com.hbm.entity.effect.EntityNukeCloudSmall;
import com.hbm.entity.logic.EntityBalefire;
import com.hbm.entity.logic.EntityNukeExplosionMK5;
import com.hbm.entity.logic.IChunkLoader;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.handler.BulletConfigSyncingUtil;
@ -371,7 +371,7 @@ public class EntityMissileCustom extends Entity implements IChunkLoader, IRadarD
Vec3 vec = Vec3.createVectorHelper(0.5, 0, 0);
for(int i = 0; i < count; i++) {
EntityBulletBase blade = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.TURBINE);
EntityBulletBaseNT blade = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.TURBINE);
blade.setPositionAndRotation(this.posX - this.motionX, this.posY - this.motionY + rand.nextGaussian(), this.posZ - this.motionZ, 0, 0);
blade.motionX = vec.xCoord;
blade.motionZ = vec.zCoord;

View File

@ -7,7 +7,6 @@ import java.util.Set;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.MobConfig;
import com.hbm.entity.mob.ai.EntityAIBreaking;
import com.hbm.entity.mob.ai.EntityAI_MLPF;
import com.hbm.entity.pathfinder.PathFinderUtils;
import com.hbm.entity.projectile.EntityBullet;
import com.hbm.items.ModItems;

View File

@ -3,7 +3,7 @@ package com.hbm.entity.mob;
import java.util.ArrayList;
import java.util.List;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.items.ModItems;
import com.hbm.packet.AuxParticlePacketNT;
@ -72,7 +72,7 @@ public class EntityTaintCrab extends EntityCyberCrab {
@Override
public void attackEntityWithRangedAttack(EntityLivingBase entity, float f) {
EntityBulletBase bullet = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.BMG50_STAR, this);
EntityBulletBaseNT bullet = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.BMG50_STAR, this);
Vec3 motion = Vec3.createVectorHelper(posX - entity.posX, posY - entity.posZ - entity.height / 2, posZ - entity.posZ);
motion = motion.normalize();
NBTTagCompound data = new NBTTagCompound();

View File

@ -3,7 +3,7 @@ package com.hbm.entity.mob;
import java.util.ArrayList;
import java.util.List;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.explosion.ExplosionNukeSmall;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.items.ModItems;
@ -326,8 +326,8 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
Vec3 heading = Vec3.createVectorHelper(e.posX - pivotX, e.posY + e.height / 2 - pivotY, e.posZ - pivotZ);
heading = heading.normalize();
EntityBulletBase bullet = new EntityBulletBase(this.worldObj, BulletConfigSyncingUtil.WORM_LASER);
bullet.shooter = this;
EntityBulletBaseNT bullet = new EntityBulletBaseNT(this.worldObj, BulletConfigSyncingUtil.WORM_LASER);
bullet.setThrower(this);
bullet.setPosition(pivotX, pivotY, pivotZ);
bullet.setThrowableHeading(heading.xCoord, heading.yCoord, heading.zCoord, 2F, 0.02F);
this.worldObj.spawnEntityInWorld(bullet);
@ -339,8 +339,8 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
Vec3 heading = Vec3.createVectorHelper(e.posX - this.posX, e.posY + e.height / 2 - posY - 0.5D, e.posZ - this.posZ);
heading = heading.normalize();
EntityBulletBase bullet = new EntityBulletBase(this.worldObj, BulletConfigSyncingUtil.UFO_ROCKET);
bullet.shooter = this;
EntityBulletBaseNT bullet = new EntityBulletBaseNT(this.worldObj, BulletConfigSyncingUtil.UFO_ROCKET);
bullet.setThrower(this);
bullet.setPosition(this.posX, this.posY - 0.5D, this.posZ);
bullet.setThrowableHeading(heading.xCoord, heading.yCoord, heading.zCoord, 2F, 0.02F);
bullet.getEntityData().setInteger("homingTarget", e.getEntityId());
@ -350,7 +350,7 @@ public class EntityUFO extends EntityFlying implements IMob, IBossDisplayData, I
@Override
public boolean canAttackClass(Class clazz) {
return clazz != this.getClass() && clazz != EntityBulletBase.class;
return clazz != this.getClass() && clazz != EntityBulletBaseNT.class;
}
@Override

View File

@ -1,6 +1,6 @@
package com.hbm.entity.mob.ai;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import net.minecraft.entity.EntityCreature;
@ -52,7 +52,7 @@ public class EntityAIMaskmanLasergun extends EntityAIBase {
switch(attack) {
case ORB:
EntityBulletBase orb = new EntityBulletBase(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_ORB, owner, target, 2.0F, 0);
EntityBulletBaseNT orb = new EntityBulletBaseNT(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_ORB, owner, target, 2.0F, 0);
orb.motionY += 0.5D;
owner.worldObj.spawnEntityInWorld(orb);
@ -60,7 +60,7 @@ public class EntityAIMaskmanLasergun extends EntityAIBase {
break;
case MISSILE:
EntityBulletBase missile = new EntityBulletBase(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_ROCKET, owner, target, 1.0F, 0);
EntityBulletBaseNT missile = new EntityBulletBaseNT(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_ROCKET, owner, target, 1.0F, 0);
Vec3 vec = Vec3.createVectorHelper(target.posX - owner.posX, 0, target.posZ - owner.posZ);
missile.motionX = vec.xCoord * 0.05D;
missile.motionY = 0.5D + owner.getRNG().nextDouble() * 0.5D;
@ -73,7 +73,7 @@ public class EntityAIMaskmanLasergun extends EntityAIBase {
case SPLASH:
for(int i = 0; i < 5; i++) {
EntityBulletBase tracer = new EntityBulletBase(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_TRACER, owner, target, 1.0F, 0.05F);
EntityBulletBaseNT tracer = new EntityBulletBaseNT(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_TRACER, owner, target, 1.0F, 0.05F);
owner.worldObj.spawnEntityInWorld(tracer);
}
break;

View File

@ -1,6 +1,6 @@
package com.hbm.entity.mob.ai;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import net.minecraft.entity.EntityCreature;
@ -49,7 +49,7 @@ public class EntityAIMaskmanMinigun extends EntityAIBase {
if(timer <= 0) {
timer = delay;
EntityBulletBase bullet = new EntityBulletBase(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_BULLET, owner, target, 1.0F, 0);
EntityBulletBaseNT bullet = new EntityBulletBaseNT(owner.worldObj, BulletConfigSyncingUtil.MASKMAN_BULLET, owner, target, 1.0F, 0);
owner.worldObj.spawnEntityInWorld(bullet);
owner.playSound("hbm:weapon.calShoot", 1.0F, 1.0F);
}

View File

@ -1,6 +1,6 @@
package com.hbm.entity.mob.botprime;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import api.hbm.entity.IRadiationImmune;
@ -80,14 +80,14 @@ public abstract class EntityBOTPrimeBase extends EntityWormBaseNT implements IRa
for(int i = 0; i < 5; i++) {
EntityBulletBase bullet = new EntityBulletBase(this.worldObj, BulletConfigSyncingUtil.WORM_LASER, this, living, 1.0F, i * 0.05F);
EntityBulletBaseNT bullet = new EntityBulletBaseNT(this.worldObj, BulletConfigSyncingUtil.WORM_LASER, this, living, 1.0F, i * 0.05F);
this.worldObj.spawnEntityInWorld(bullet);
}
this.playSound("hbm:weapon.ballsLaser", 5.0F, 0.75F);
} else {
EntityBulletBase bullet = new EntityBulletBase(this.worldObj, BulletConfigSyncingUtil.WORM_BOLT, this, living, 0.5F, 0.125F);
EntityBulletBaseNT bullet = new EntityBulletBaseNT(this.worldObj, BulletConfigSyncingUtil.WORM_BOLT, this, living, 0.5F, 0.125F);
this.worldObj.spawnEntityInWorld(bullet);
this.playSound("hbm:weapon.ballsLaser", 5.0F, 1.0F);
}

View File

@ -1,706 +0,0 @@
package com.hbm.entity.projectile;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.RedBarrel;
import com.hbm.entity.effect.EntityCloudFleijaRainbow;
import com.hbm.entity.effect.EntityEMPBlast;
import com.hbm.entity.logic.EntityNukeExplosionMK3;
import com.hbm.entity.logic.EntityNukeExplosionMK5;
import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionNukeGeneric;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.main.MainRegistry;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.potion.HbmPotion;
import com.hbm.util.ArmorUtil;
import com.hbm.util.BobMathUtil;
import com.hbm.util.Tuple.Pair;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class EntityBulletBase extends Entity implements IProjectile, IBulletBase {
@Override public double prevX() { return prevRenderX; }
@Override public double prevY() { return prevRenderY; }
@Override public double prevZ() { return prevRenderZ; }
@Override public void prevX(double d) { prevRenderX = d; }
@Override public void prevY(double d) { prevRenderY = d; }
@Override public void prevZ(double d) { prevRenderZ = d; }
@Override public List<Pair<Vec3, Double>> nodes() { return this.trailNodes; }
private BulletConfiguration config;
public EntityLivingBase shooter;
public float overrideDamage;
public double prevRenderX;
public double prevRenderY;
public double prevRenderZ;
public final List<Pair<Vec3, Double>> trailNodes = new ArrayList();
public BulletConfiguration getConfig() {
return config;
}
public EntityBulletBase(World world) {
super(world);
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
}
public EntityBulletBase(World world, int config) {
super(world);
this.config = BulletConfigSyncingUtil.pullConfig(config);
this.dataWatcher.updateObject(18, config);
this.renderDistanceWeight = 10.0D;
if(this.config == null) {
this.setDead();
return;
}
this.dataWatcher.updateObject(16, (byte)this.config.style);
this.dataWatcher.updateObject(17, (byte)this.config.trail);
this.setSize(0.5F, 0.5F);
}
public EntityBulletBase(World world, int config, EntityLivingBase entity) {
super(world);
this.config = BulletConfigSyncingUtil.pullConfig(config);
this.dataWatcher.updateObject(18, config);
shooter = entity;
ItemStack gun = entity.getHeldItem();
boolean offsetShot = true;
if(gun != null && gun.getItem() instanceof ItemGunBase) {
GunConfiguration cfg = ((ItemGunBase) gun.getItem()).mainConfig;
if(cfg != null && cfg.hasSights && entity.isSneaking()) {
offsetShot = false;
}
}
this.setLocationAndAngles(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ, entity.rotationYaw, entity.rotationPitch);
if(offsetShot) {
double sideOffset = 0.16D;
this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * sideOffset;
this.posY -= 0.1D;
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * sideOffset;
} else {
this.posY -= 0.1D;
}
this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI));
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.0F, this.config.spread * (offsetShot ? 1F : 0.25F));
this.dataWatcher.updateObject(16, (byte)this.config.style);
this.dataWatcher.updateObject(17, (byte)this.config.trail);
}
public EntityBulletBase(World world, int config, EntityLivingBase entity, EntityLivingBase target, float motion, float deviation) {
super(world);
this.config = BulletConfigSyncingUtil.pullConfig(config);
this.dataWatcher.updateObject(18, config);
this.shooter = entity;
this.renderDistanceWeight = 10.0D;
this.setSize(0.5F, 0.5F);
this.posY = entity.posY + entity.getEyeHeight() - 0.10000000149011612D;
double d0 = target.posX - entity.posX;
double d1 = target.boundingBox.minY + target.height / 3.0F - this.posY;
double d2 = target.posZ - entity.posZ;
double d3 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);
if (d3 >= 1.0E-7D) {
float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI));
double d4 = d0 / d3;
double d5 = d2 / d3;
this.setLocationAndAngles(entity.posX + d4, this.posY, entity.posZ + d5, f2, f3);
this.yOffset = 0.0F;
this.setThrowableHeading(d0, d1, d2, motion, deviation);
}
this.dataWatcher.updateObject(16, (byte)this.config.style);
this.dataWatcher.updateObject(17, (byte)this.config.trail);
}
public boolean attackEntityFrom(DamageSource source, float amount) {
this.setBeenAttacked();
if(source instanceof EntityDamageSource) {
EntityDamageSource dmg = (EntityDamageSource) source;
if(dmg.damageType.equals("player")) {
this.motionX *= -1.5;
this.motionY *= -1.5;
this.motionZ *= -1.5;
return true;
}
}
return false;
}
@Override
public void setThrowableHeading(double moX, double moY, double moZ, float mult1, float mult2) {
float f2 = MathHelper.sqrt_double(moX * moX + moY * moY + moZ * moZ);
moX /= f2;
moY /= f2;
moZ /= f2;
moX += this.rand.nextGaussian() * mult2;
moY += this.rand.nextGaussian() * mult2;
moZ += this.rand.nextGaussian() * mult2;
moX *= mult1;
moY *= mult1;
moZ *= mult1;
this.motionX = moX;
this.motionY = moY;
this.motionZ = moZ;
float f3 = MathHelper.sqrt_double(moX * moX + moZ * moZ);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(moX, moZ) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(moY, f3) * 180.0D / Math.PI);
}
@Override
@SideOnly(Side.CLIENT)
public void setPositionAndRotation2(double x, double y, double z, float r0, float r1, int i) {
this.setPosition(x, y, z);
this.setRotation(r0, r1);
}
@Override
@SideOnly(Side.CLIENT)
public void setVelocity(double x, double y, double z) {
this.motionX = x;
this.motionY = y;
this.motionZ = z;
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
float f = MathHelper.sqrt_double(x * x + z * z);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(x, z) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(y, f) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch;
this.prevRotationYaw = this.rotationYaw;
this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
}
}
@Override
protected void entityInit() {
//style
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
//trail
this.dataWatcher.addObject(17, Byte.valueOf((byte) 0));
//bullet config sync
this.dataWatcher.addObject(18, Integer.valueOf((int) 0));
}
@Override
public void onUpdate() {
super.onUpdate();
if(config == null)
config = BulletConfigSyncingUtil.pullConfig(dataWatcher.getWatchableObjectInt(18));
if(config == null){
this.setDead();
return;
}
if(worldObj.isRemote && config.style == config.STYLE_TAU) {
if(trailNodes.isEmpty()) {
this.ignoreFrustumCheck = true;
trailNodes.add(new Pair<Vec3, Double>(Vec3.createVectorHelper(-motionX * 2, -motionY * 2, -motionZ * 2), 0D));
} else {
trailNodes.add(new Pair<Vec3, Double>(Vec3.createVectorHelper(0, 0, 0), 1D));
}
}
if(this.config.blackPowder && this.ticksExisted == 1) {
for(int i = 0; i < 15; i++) {
double mod = rand.nextDouble();
this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ,
(this.motionX + rand.nextGaussian() * 0.05) * mod,
(this.motionY + rand.nextGaussian() * 0.05) * mod,
(this.motionZ + rand.nextGaussian() * 0.05) * mod);
}
double mod = 0.5;
this.worldObj.spawnParticle("flame", this.posX + this.motionX * mod, this.posY + this.motionY * mod, this.posZ + this.motionZ * mod, 0, 0, 0);
}
if(config.maxAge == 0) {
if(this.config.bUpdate != null)
this.config.bUpdate.behaveUpdate(this);
this.setDead();
return;
}
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
}
/// ZONE 1 START ///
//entity and block collision, plinking
/// ZONE 2 START ///
//entity detection
Vec3 vecOrigin = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 vecDestination = Vec3.createVectorHelper(this.posX + this.motionX * this.config.velocity, this.posY + this.motionY * this.config.velocity, this.posZ + this.motionZ * this.config.velocity);
MovingObjectPosition movement = this.worldObj.func_147447_a(vecOrigin, vecDestination, false, true, false);
vecOrigin = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
vecDestination = Vec3.createVectorHelper(this.posX + this.motionX * this.config.velocity, this.posY + this.motionY * this.config.velocity, this.posZ + this.motionZ * this.config.velocity);
MovingObjectPosition impact = null;
Entity victim = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX * this.config.velocity, this.motionY * this.config.velocity, this.motionZ * this.config.velocity).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
int i;
float f1;
for (i = 0; i < list.size(); ++i) {
Entity entity1 = (Entity) list.get(i);
if (entity1.canBeCollidedWith() && (entity1 != this.shooter)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vecOrigin, vecDestination);
if (movingobjectposition1 != null) {
double d1 = vecOrigin.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D) {
victim = entity1;
impact = movingobjectposition1;
d0 = d1;
}
}
}
}
if (victim != null) {
movement = new MovingObjectPosition(victim);
movement.hitVec.yCoord += victim.height * 0.5D;
}
/// ZONE 2 END ///
boolean didBounce = false;
if(movement != null) {
//handle entity collision
if(movement.entityHit != null) {
DamageSource damagesource = this.config.getDamage(this, shooter);
if(!worldObj.isRemote) {
if(!config.doesPenetrate) {
this.setPosition(movement.hitVec.xCoord, movement.hitVec.yCoord, movement.hitVec.zCoord);
onEntityImpact(victim);
} else {
onEntityHurt(victim);
}
}
float damage = rand.nextFloat() * (config.dmgMax - config.dmgMin) + config.dmgMin;
if(overrideDamage != 0)
damage = overrideDamage;
boolean headshot = false;
if(victim instanceof EntityLivingBase && this.config.headshotMult > 1F) {
EntityLivingBase living = (EntityLivingBase) victim;
double head = living.height - living.getEyeHeight();
if(!!living.isEntityAlive() && impact.hitVec != null && impact.hitVec.yCoord > (living.posY + living.height - head * 2)) {
damage *= this.config.headshotMult;
headshot = true;
}
}
if(victim != null && !victim.attackEntityFrom(damagesource, damage)) {
try {
Field lastDamage = ReflectionHelper.findField(EntityLivingBase.class, "lastDamage", "field_110153_bc");
float dmg = (float) damage + lastDamage.getFloat(victim);
if(!victim.attackEntityFrom(damagesource, dmg)) {
headshot = false;
}
} catch (Exception x) { }
}
if(!worldObj.isRemote && headshot) {
if(victim instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) victim;
double head = living.height - living.getEyeHeight();
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setInteger("count", 15);
data.setDouble("motion", 0.1D);
data.setString("mode", "blockdust");
data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, living.posX, living.posY + living.height - head, living.posZ), new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50));
worldObj.playSoundEffect(victim.posX, victim.posY, victim.posZ, "mob.zombie.woodbreak", 1.0F, 0.95F + rand.nextFloat() * 0.2F);
}
}
//handle block collision
} else if(worldObj.getBlock(movement.blockX, movement.blockY, movement.blockZ).getMaterial() != Material.air) {
boolean hRic = rand.nextInt(100) < config.HBRC;
boolean doesRic = config.doesRicochet || hRic;
if(!config.isSpectral && !doesRic) {
this.setPosition(movement.hitVec.xCoord, movement.hitVec.yCoord, movement.hitVec.zCoord);
this.onBlockImpact(movement.blockX, movement.blockY, movement.blockZ);
}
if(doesRic) {
Vec3 face = null;
switch(movement.sideHit) {
case 0:
face = Vec3.createVectorHelper(0, -1, 0); break;
case 1:
face = Vec3.createVectorHelper(0, 1, 0); break;
case 2:
face = Vec3.createVectorHelper(0, 0, 1); break;
case 3:
face = Vec3.createVectorHelper(0, 0, -1); break;
case 4:
face = Vec3.createVectorHelper(-1, 0, 0); break;
case 5:
face = Vec3.createVectorHelper(1, 0, 0); break;
}
if(face != null) {
Vec3 vel = Vec3.createVectorHelper(motionX, motionY, motionZ);
vel.normalize();
boolean lRic = rand.nextInt(100) < config.LBRC;
double angle = Math.abs(BobMathUtil.getCrossAngle(vel, face) - 90);
if(hRic || (angle <= config.ricochetAngle && lRic)) {
switch(movement.sideHit) {
case 0:
case 1:
motionY *= -1; break;
case 2:
case 3:
motionZ *= -1; break;
case 4:
case 5:
motionX *= -1; break;
}
if(config.plink == 1)
worldObj.playSoundAtEntity(this, "hbm:weapon.ricochet", 0.25F, 1.0F);
if(config.plink == 2)
worldObj.playSoundAtEntity(this, "hbm:weapon.gBounce", 1.0F, 1.0F);
onRicochet(movement.blockX, movement.blockY, movement.blockZ);
} else {
if(!worldObj.isRemote) {
this.setPosition(movement.hitVec.xCoord, movement.hitVec.yCoord, movement.hitVec.zCoord);
onBlockImpact(movement.blockX, movement.blockY, movement.blockZ);
}
}
this.posX += (movement.hitVec.xCoord - this.posX) * 0.6;
this.posY += (movement.hitVec.yCoord - this.posY) * 0.6;
this.posZ += (movement.hitVec.zCoord - this.posZ) * 0.6;
this.motionX *= config.bounceMod;
this.motionY *= config.bounceMod;
this.motionZ *= config.bounceMod;
didBounce = true;
}
}
}
}
/// ZONE 1 END ///
if(!didBounce) {
motionY -= config.gravity;
this.posX += this.motionX * this.config.velocity;
this.posY += this.motionY * this.config.velocity;
this.posZ += this.motionZ * this.config.velocity;
this.setPosition(this.posX, this.posY, this.posZ);
}
/// SPECIAL UPDATE BEHAVIOR ///
if(this.config.bUpdate != null)
this.config.bUpdate.behaveUpdate(this);
float f2;
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 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;
}
if(this.ticksExisted > config.maxAge)
this.setDead();
if(worldObj.isRemote && !config.vPFX.isEmpty()) {
Vec3 vec = Vec3.createVectorHelper(posX - prevPosX, posY - prevPosY, posZ - prevPosZ);
double motion = Math.max(vec.lengthVector(), 0.1);
vec = vec.normalize();
for(double d = 0; d < motion; d += 0.5) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("type", "vanillaExt");
nbt.setString("mode", config.vPFX);
nbt.setDouble("posX", this.posX - vec.xCoord * d);
nbt.setDouble("posY", this.posY - vec.yCoord * d);
nbt.setDouble("posZ", this.posZ - vec.zCoord * d);
MainRegistry.proxy.effectNT(nbt);
}
}
//this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
//this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
}
//for when a bullet dies by hitting a block
private void onBlockImpact(int bX, int bY, int bZ) {
if(config.bImpact != null)
config.bImpact.behaveBlockHit(this, bX, bY, bZ);
if(!worldObj.isRemote && !config.liveAfterImpact)
this.setDead();
if(config.incendiary > 0 && !this.worldObj.isRemote) {
if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX, (int)posY, (int)posZ, Blocks.fire);
if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX + 1, (int)posY, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX + 1, (int)posY, (int)posZ, Blocks.fire);
if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX - 1, (int)posY, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX - 1, (int)posY, (int)posZ, Blocks.fire);
if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY + 1, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX, (int)posY + 1, (int)posZ, Blocks.fire);
if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY - 1, (int)posZ) == Blocks.air) worldObj.setBlock((int)posX, (int)posY - 1, (int)posZ, Blocks.fire);
if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY, (int)posZ + 1) == Blocks.air) worldObj.setBlock((int)posX, (int)posY, (int)posZ + 1, Blocks.fire);
if(worldObj.rand.nextInt(3) == 0 && worldObj.getBlock((int)posX, (int)posY, (int)posZ - 1) == Blocks.air) worldObj.setBlock((int)posX, (int)posY, (int)posZ - 1, Blocks.fire);
}
if(config.emp > 0)
ExplosionNukeGeneric.empBlast(this.worldObj, (int)(this.posX + 0.5D), (int)(this.posY + 0.5D), (int)(this.posZ + 0.5D), config.emp);
if(config.emp > 3) {
if (!this.worldObj.isRemote) {
EntityEMPBlast cloud = new EntityEMPBlast(this.worldObj, config.emp);
cloud.posX = this.posX;
cloud.posY = this.posY + 0.5F;
cloud.posZ = this.posZ;
this.worldObj.spawnEntityInWorld(cloud);
}
}
if(config.jolt > 0 && !worldObj.isRemote)
ExplosionLarge.jolt(worldObj, posX, posY, posZ, config.jolt, 150, 0.25);
if(config.explosive > 0 && !worldObj.isRemote)
worldObj.newExplosion(this, posX, posY, posZ, config.explosive, config.incendiary > 0, config.blockDamage);
if(config.shrapnel > 0 && !worldObj.isRemote)
ExplosionLarge.spawnShrapnels(worldObj, posX, posY, posZ, config.shrapnel);
if(config.chlorine > 0 && !worldObj.isRemote) {
ExplosionChaos.spawnChlorine(worldObj, posX, posY, posZ, config.chlorine, 1.5, 0);
worldObj.playSoundEffect((double)(posX + 0.5F), (double)(posY + 0.5F), (double)(posZ + 0.5F), "random.fizz", 5.0F, 2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F);
}
if(config.rainbow > 0 && !worldObj.isRemote) {
EntityNukeExplosionMK3 ex = EntityNukeExplosionMK3.statFacFleija(worldObj, posX, posY, posZ, config.rainbow);
if(!ex.isDead) {
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 100.0f, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
worldObj.spawnEntityInWorld(ex);
EntityCloudFleijaRainbow cloud = new EntityCloudFleijaRainbow(this.worldObj, config.rainbow);
cloud.posX = this.posX;
cloud.posY = this.posY;
cloud.posZ = this.posZ;
this.worldObj.spawnEntityInWorld(cloud);
}
}
if(config.nuke > 0 && !worldObj.isRemote) {
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, config.nuke, posX, posY, posZ).mute());
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "muke");
if(MainRegistry.polaroidID == 11 || rand.nextInt(100) == 0) data.setBoolean("balefire", true);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
}
if(config.destroysBlocks && !worldObj.isRemote) {
if(worldObj.getBlock(bX, bY, bZ).getBlockHardness(worldObj, bX, bY, bZ) <= 120)
worldObj.func_147480_a(bX, bY, bZ, false);
} else if(config.doesBreakGlass && !worldObj.isRemote) {
if(worldObj.getBlock(bX, bY, bZ) == Blocks.glass ||
worldObj.getBlock(bX, bY, bZ) == Blocks.glass_pane ||
worldObj.getBlock(bX, bY, bZ) == Blocks.stained_glass ||
worldObj.getBlock(bX, bY, bZ) == Blocks.stained_glass_pane)
worldObj.func_147480_a(bX, bY, bZ, false);
if(worldObj.getBlock(bX, bY, bZ) == ModBlocks.red_barrel)
((RedBarrel) ModBlocks.red_barrel).explode(worldObj, bX, bY, bZ);
}
}
//for when a bullet dies by hitting a block
private void onRicochet(int bX, int bY, int bZ) {
if(config.bRicochet != null)
config.bRicochet.behaveBlockRicochet(this, bX, bY, bZ);
}
//for when a bullet dies by hitting an entity
private void onEntityImpact(Entity e) {
onEntityHurt(e);
onBlockImpact(-1, -1, -1);
if(config.bHit != null)
config.bHit.behaveEntityHit(this, e);
}
//for when a bullet hurts an entity, not necessarily dying
private void onEntityHurt(Entity e) {
if(config.bHurt != null)
config.bHurt.behaveEntityHurt(this, e);
if(config.incendiary > 0 && !worldObj.isRemote) {
e.setFire(config.incendiary);
}
if(config.leadChance > 0 && !worldObj.isRemote && worldObj.rand.nextInt(100) < config.leadChance && e instanceof EntityLivingBase) {
((EntityLivingBase)e).addPotionEffect(new PotionEffect(HbmPotion.lead.id, 10 * 20, 0));
}
if(e instanceof EntityLivingBase && config.effects != null && !config.effects.isEmpty() && !worldObj.isRemote) {
for(PotionEffect effect : config.effects) {
((EntityLivingBase)e).addPotionEffect(new PotionEffect(effect));
}
}
if(config.instakill && e instanceof EntityLivingBase && !worldObj.isRemote) {
if(!(e instanceof EntityPlayer && ((EntityPlayer)e).capabilities.isCreativeMode))
((EntityLivingBase)e).setHealth(0.0F);
}
if(config.caustic > 0 && e instanceof EntityPlayer){
ArmorUtil.damageSuit((EntityPlayer)e, 0, config.caustic);
ArmorUtil.damageSuit((EntityPlayer)e, 1, config.caustic);
ArmorUtil.damageSuit((EntityPlayer)e, 2, config.caustic);
ArmorUtil.damageSuit((EntityPlayer)e, 3, config.caustic);
}
}
@Override
protected void readEntityFromNBT(NBTTagCompound nbt) {
int cfg = nbt.getInteger("config");
this.config = BulletConfigSyncingUtil.pullConfig(cfg);
if(this.config == null) {
this.setDead();
return;
}
this.overrideDamage = nbt.getFloat("damage");
this.dataWatcher.updateObject(18, cfg);
this.dataWatcher.updateObject(16, (byte)this.config.style);
this.dataWatcher.updateObject(17, (byte)this.config.trail);
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbt) {
nbt.setInteger("config", dataWatcher.getWatchableObjectInt(18));
nbt.setFloat("damage", this.overrideDamage);
}
}

View File

@ -211,12 +211,12 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
if(!worldObj.isRemote) {
if(config.maxAge == 0) {
if(this.config.bUpdate != null) this.config.bntUpdate.behaveUpdate(this);
if(this.config.bntUpdate != null) this.config.bntUpdate.behaveUpdate(this);
this.setDead();
return;
}
if(this.config.bUpdate != null) this.config.bntUpdate.behaveUpdate(this);
if(this.config.bntUpdate != null) this.config.bntUpdate.behaveUpdate(this);
if(this.ticksExisted > config.maxAge) this.setDead();
}
@ -568,9 +568,9 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
nbt.setFloat("damage", this.overrideDamage);
}
public interface IBulletHurtBehaviorNT { public void behaveEntityHurt(EntityBulletBaseNT bullet, Entity hit); }
public interface IBulletHitBehaviorNT { public void behaveEntityHit(EntityBulletBaseNT bullet, Entity hit); }
public interface IBulletRicochetBehaviorNT { public void behaveBlockRicochet(EntityBulletBaseNT bullet, int x, int y, int z); }
public interface IBulletImpactBehaviorNT { public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z); }
public interface IBulletUpdateBehaviorNT { public void behaveUpdate(EntityBulletBaseNT bullet); }
public static interface IBulletHurtBehaviorNT { public void behaveEntityHurt(EntityBulletBaseNT bullet, Entity hit); }
public static interface IBulletHitBehaviorNT { public void behaveEntityHit(EntityBulletBaseNT bullet, Entity hit); }
public static interface IBulletRicochetBehaviorNT { public void behaveBlockRicochet(EntityBulletBaseNT bullet, int x, int y, int z); }
public static interface IBulletImpactBehaviorNT { public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z); }
public static interface IBulletUpdateBehaviorNT { public void behaveUpdate(EntityBulletBaseNT bullet); }
}

View File

@ -3,7 +3,7 @@ package com.hbm.entity.projectile;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World;
public class EntityCombineBallNT extends EntityBulletBase {
public class EntityCombineBallNT extends EntityBulletBaseNT {
public EntityCombineBallNT(World world, int config, EntityLivingBase shooter) {
super(world, config, shooter);
@ -13,6 +13,6 @@ public class EntityCombineBallNT extends EntityBulletBase {
@Override
public void setDead() {
super.setDead();
worldObj.createExplosion(shooter, posX, posY, posZ, 2, false);
worldObj.createExplosion(this.getThrower(), posX, posY, posZ, 2, false);
}
}

View File

@ -327,6 +327,10 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
public float getShadowSize() {
return 0.0F;
}
public void setThrower(EntityLivingBase thrower) {
this.thrower = thrower;
}
public EntityLivingBase getThrower() {
if(this.thrower == null && this.throwerName != null && this.throwerName.length() > 0) {

View File

@ -24,7 +24,7 @@ import com.hbm.entity.effect.EntityNukeCloudSmall;
import com.hbm.entity.grenade.EntityGrenadeASchrab;
import com.hbm.entity.grenade.EntityGrenadeNuclear;
import com.hbm.entity.missile.EntityMIRV;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.entity.projectile.EntityExplosiveBeam;
import com.hbm.interfaces.Spaghetti;
import com.hbm.items.ModItems;
@ -108,7 +108,7 @@ public class ExplosionNukeGeneric {
e instanceof EntityGrenadeASchrab ||
e instanceof EntityGrenadeNuclear ||
e instanceof EntityExplosiveBeam ||
e instanceof EntityBulletBase ||
e instanceof EntityBulletBaseNT ||
e instanceof EntityPlayer &&
ArmorUtil.checkArmor((EntityPlayer) e, ModItems.euphemium_helmet, ModItems.euphemium_plate, ModItems.euphemium_legs, ModItems.euphemium_boots)) {
return true;

View File

@ -2,15 +2,9 @@ package com.hbm.handler;
import java.util.List;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.entity.projectile.EntityBulletBaseNT.*;
import com.hbm.handler.guncfg.BulletConfigFactory;
import com.hbm.interfaces.IBulletHitBehavior;
import com.hbm.interfaces.IBulletHurtBehavior;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletRicochetBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.lib.ModDamageSource;
import com.hbm.main.MainRegistry;
@ -88,11 +82,11 @@ public class BulletConfiguration implements Cloneable {
public int caustic;
public boolean destroysBlocks;
public boolean instakill;
public IBulletHurtBehavior bHurt;
/*public IBulletHurtBehavior bHurt;
public IBulletHitBehavior bHit;
public IBulletRicochetBehavior bRicochet;
public IBulletImpactBehavior bImpact;
public IBulletUpdateBehavior bUpdate;
public IBulletUpdateBehavior bUpdate;*/
public IBulletHurtBehaviorNT bntHurt;
public IBulletHitBehaviorNT bntHit;
public IBulletRicochetBehaviorNT bntRicochet;
@ -179,13 +173,13 @@ public class BulletConfiguration implements Cloneable {
public BulletConfiguration setToGuided() {
this.bUpdate = BulletConfigFactory.getLaserSteering();
this.bntUpdate = BulletConfigFactory.getLaserSteering();
this.doesRicochet = false;
return this;
}
public BulletConfiguration getChlorophyte() {
this.bUpdate = BulletConfigFactory.getHomingBehavior(200, 45);
this.bntUpdate = BulletConfigFactory.getHomingBehavior(200, 45);
this.dmgMin *= 1.5F;
this.dmgMax *= 1.5F;
this.wear *= 0.5;
@ -219,28 +213,6 @@ public class BulletConfiguration implements Cloneable {
return this;
}
public DamageSource getDamage(EntityBulletBase bullet, EntityLivingBase shooter) {
DamageSource dmg;
String unloc = damageType;
if(unloc.equals(ModDamageSource.s_zomg_prefix))
unloc += (bullet.worldObj.rand.nextInt(5) + 1); //pain
if(shooter != null)
dmg = new EntityDamageSourceIndirect(unloc, bullet, shooter);
else
dmg = new DamageSource(unloc);
if(this.dmgProj) dmg.setProjectile();
if(this.dmgFire) dmg.setFireDamage();
if(this.dmgExplosion) dmg.setExplosion();
if(this.dmgBypass) dmg.setDamageBypassesArmor();
return dmg;
}
public DamageSource getDamage(EntityBulletBaseNT bullet, EntityLivingBase shooter) {
DamageSource dmg;

View File

@ -4,13 +4,12 @@ import java.util.List;
import java.util.Random;
import com.hbm.entity.particle.EntityBSmokeFX;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.entity.projectile.EntityBulletBaseNT.*;
import com.hbm.explosion.ExplosionNukeSmall;
import com.hbm.explosion.ExplosionNukeSmall.MukeParams;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ItemAmmoEnums.*;
import com.hbm.items.ModItems;
@ -144,10 +143,10 @@ public class BulletConfigFactory {
bullet.leadChance = 0;
bullet.vPFX = "reddust";
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
if(bullet.worldObj.isRemote)
return;
@ -164,9 +163,10 @@ public class BulletConfigFactory {
Vec3 motion = Vec3.createVectorHelper(bullet.posX - dx, bullet.posY - dy, bullet.posZ - dz);
motion = motion.normalize();
EntityBulletBase bolt = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.R556_FLECHETTE_DU);
EntityBulletBaseNT bolt = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.R556_FLECHETTE_DU);
bolt.setPosition(dx, dy, dz);
bolt.setThrowableHeading(motion.xCoord, motion.yCoord, motion.zCoord, 0.5F, 0.1F);
bolt.setThrower(bullet.getThrower());
bullet.worldObj.spawnEntityInWorld(bolt);
if(i < 30) {
@ -310,12 +310,12 @@ public class BulletConfigFactory {
}
}
public static IBulletImpactBehavior getPhosphorousEffect(final int radius, final int duration, final int count, final double motion, float hazeChance) {
public static IBulletImpactBehaviorNT getPhosphorousEffect(final int radius, final int duration, final int count, final double motion, float hazeChance) {
IBulletImpactBehavior impact = new IBulletImpactBehavior() {
IBulletImpactBehaviorNT impact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
List<Entity> hit = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX - radius, bullet.posY - radius, bullet.posZ - radius, bullet.posX + radius, bullet.posY + radius, bullet.posZ + radius));
@ -352,12 +352,12 @@ public class BulletConfigFactory {
return impact;
}
public static IBulletImpactBehavior getGasEffect(final int radius, final int duration) {
public static IBulletImpactBehaviorNT getGasEffect(final int radius, final int duration) {
IBulletImpactBehavior impact = new IBulletImpactBehavior() {
IBulletImpactBehaviorNT impact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
List<Entity> hit = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX - radius, bullet.posY - radius, bullet.posZ - radius, bullet.posX + radius, bullet.posY + radius, bullet.posZ + radius));
@ -401,20 +401,20 @@ public class BulletConfigFactory {
return impact;
}
public static IBulletUpdateBehavior getLaserSteering() {
public static IBulletUpdateBehaviorNT getLaserSteering() {
IBulletUpdateBehavior onUpdate = new IBulletUpdateBehavior() {
IBulletUpdateBehaviorNT onUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.shooter == null || !(bullet.shooter instanceof EntityPlayer))
if(bullet.getThrower() == null || !(bullet.getThrower() instanceof EntityPlayer))
return;
if(Vec3.createVectorHelper(bullet.posX - bullet.shooter.posX, bullet.posY - bullet.shooter.posY, bullet.posZ - bullet.shooter.posZ).lengthVector() > 100)
if(Vec3.createVectorHelper(bullet.posX - bullet.getThrower().posX, bullet.posY - bullet.getThrower().posY, bullet.posZ - bullet.getThrower().posZ).lengthVector() > 100)
return;
MovingObjectPosition mop = Library.rayTrace((EntityPlayer)bullet.shooter, 200, 1);
MovingObjectPosition mop = Library.rayTrace((EntityPlayer)bullet.getThrower(), 200, 1);
if(mop == null || mop.hitVec == null)
return;
@ -438,12 +438,12 @@ public class BulletConfigFactory {
return onUpdate;
}
public static IBulletUpdateBehavior getHomingBehavior(final double range, final double angle) {
public static IBulletUpdateBehaviorNT getHomingBehavior(final double range, final double angle) {
IBulletUpdateBehavior onUpdate = new IBulletUpdateBehavior() {
IBulletUpdateBehaviorNT onUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote)
return;
@ -467,7 +467,7 @@ public class BulletConfigFactory {
}
}
private void chooseTarget(EntityBulletBase bullet) {
private void chooseTarget(EntityBulletBaseNT bullet) {
List<EntityLivingBase> entities = bullet.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bullet.boundingBox.expand(range, range, range));
@ -478,7 +478,7 @@ public class BulletConfigFactory {
for(EntityLivingBase e : entities) {
if(!e.isEntityAlive() || e == bullet.shooter)
if(!e.isEntityAlive() || e == bullet.getThrower())
continue;
Vec3 delta = Vec3.createVectorHelper(e.posX - bullet.posX, e.posY + e.height / 2 - bullet.posY, e.posZ - bullet.posZ);

View File

@ -2,12 +2,9 @@ package com.hbm.handler.guncfg;
import java.util.List;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.CasingEjector;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletHurtBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ItemAmmoEnums.Ammo12Gauge;
import com.hbm.items.ModItems;
@ -372,14 +369,10 @@ public class Gun12GaugeFactory {
bullet.dmgMax = 500;
bullet.leadChance = 50;
bullet.bHurt = new IBulletHurtBehavior() {
@Override
public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) {
bullet.bntHurt = (bulletnt, hit) -> {
if(hit instanceof EntityLivingBase)
((EntityLivingBase)hit).addPotionEffect(new PotionEffect(HbmPotion.bang.id, 20, 0));
}
if(hit instanceof EntityLivingBase)
((EntityLivingBase)hit).addPotionEffect(new PotionEffect(HbmPotion.bang.id, 20, 0));
};
@ -413,38 +406,34 @@ public class Gun12GaugeFactory {
bullet.spentCasing = CASING12GAUGE.clone().register("12GaPerc").setColor(0x9E1616, SpentCasing.COLOR_CASE_12GA).setupSmoke(1F, 0.5D, 60, 40);
bullet.bUpdate = new IBulletUpdateBehavior() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
bullet.bntUpdate = (bulletnt) -> {
if(!bulletnt.worldObj.isRemote) {
Vec3 vec = Vec3.createVectorHelper(bulletnt.motionX, bulletnt.motionY, bulletnt.motionZ);
double radius = 4;
double x = bulletnt.posX + vec.xCoord;
double y = bulletnt.posY + vec.yCoord;
double z = bulletnt.posZ + vec.zCoord;
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(x, y, z, x, y, z).expand(radius, radius, radius);
List<Entity> list = bulletnt.worldObj.getEntitiesWithinAABBExcludingEntity(bulletnt.getThrower(), aabb);
if(!bullet.worldObj.isRemote) {
Vec3 vec = Vec3.createVectorHelper(bullet.motionX, bullet.motionY, bullet.motionZ);
double radius = 4;
double x = bullet.posX + vec.xCoord;
double y = bullet.posY + vec.yCoord;
double z = bullet.posZ + vec.zCoord;
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(x, y, z, x, y, z).expand(radius, radius, radius);
List<Entity> list = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet.shooter, aabb);
for(Entity e : list) {
DamageSource source = bullet.shooter instanceof EntityPlayer ? DamageSource.causePlayerDamage((EntityPlayer) bullet.shooter) : DamageSource.magic;
e.attackEntityFrom(source, 30F);
}
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "plasmablast");
data.setFloat("r", 0.75F);
data.setFloat("g", 0.75F);
data.setFloat("b", 0.75F);
data.setFloat("pitch", (float) -bullet.rotationPitch + 90);
data.setFloat("yaw", (float) bullet.rotationYaw);
data.setFloat("scale", 2F);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(bullet.dimension, x, y, z, 100));
bullet.setDead();
for(Entity e : list) {
DamageSource source = bulletnt.getThrower() instanceof EntityPlayer ? DamageSource.causePlayerDamage((EntityPlayer) bulletnt.getThrower()) : DamageSource.magic;
e.attackEntityFrom(source, 30F);
}
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "plasmablast");
data.setFloat("r", 0.75F);
data.setFloat("g", 0.75F);
data.setFloat("b", 0.75F);
data.setFloat("pitch", (float) -bulletnt.rotationPitch + 90);
data.setFloat("yaw", (float) bulletnt.rotationYaw);
data.setFloat("scale", 2F);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(bulletnt.dimension, x, y, z, 100));
bulletnt.setDead();
}
};

View File

@ -5,14 +5,11 @@ import java.util.ArrayList;
import com.hbm.entity.particle.EntityBSmokeFX;
import com.hbm.entity.projectile.EntityBoxcar;
import com.hbm.entity.projectile.EntityBuilding;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityDuchessGambit;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.CasingEjector;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletHitBehavior;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.ItemAmmoEnums.Ammo44Magnum;
@ -27,7 +24,6 @@ import com.hbm.potion.HbmPotion;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation;
@ -227,19 +223,15 @@ public class Gun44MagnumFactory {
bullet.effects = new ArrayList();
bullet.effects.add(new PotionEffect(eff));
bullet.bImpact = new IBulletImpactBehavior() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
}
bullet.bntImpact = (bulletnt, x, y, z) -> {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50));
};
bullet.spentCasing = CASING44.clone().register("44Phos");
@ -272,27 +264,21 @@ public class Gun44MagnumFactory {
bullet.wear = 25;
bullet.doesPenetrate = false;
bullet.bHit = new IBulletHitBehavior() {
@Override
public void behaveEntityHit(EntityBulletBase bullet, Entity hit) {
bullet.bntHit = (bulletnt, hit) -> {
if(!bullet.worldObj.isRemote) {
EntityBoxcar pippo = new EntityBoxcar(bullet.worldObj);
pippo.posX = hit.posX;
pippo.posY = hit.posY + 50;
pippo.posZ = hit.posZ;
for(int j = 0; j < 50; j++) {
EntityBSmokeFX fx = new EntityBSmokeFX(bullet.worldObj, pippo.posX + (bullet.worldObj.rand.nextDouble() - 0.5) * 4, pippo.posY + (bullet.worldObj.rand.nextDouble() - 0.5) * 12, pippo.posZ + (bullet.worldObj.rand.nextDouble() - 0.5) * 4, 0, 0, 0);
bullet.worldObj.spawnEntityInWorld(fx);
}
bullet.worldObj.spawnEntityInWorld(pippo);
bullet.worldObj.playSoundEffect(pippo.posX,
pippo.posY + 50,
pippo.posZ, "hbm:alarm.trainHorn", 100F, 1F);
if(!bulletnt.worldObj.isRemote) {
EntityBoxcar pippo = new EntityBoxcar(bulletnt.worldObj);
pippo.posX = hit.posX;
pippo.posY = hit.posY + 50;
pippo.posZ = hit.posZ;
for(int j = 0; j < 50; j++) {
EntityBSmokeFX fx = new EntityBSmokeFX(bulletnt.worldObj, pippo.posX + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 4, pippo.posY + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 12, pippo.posZ + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 4, 0, 0, 0);
bulletnt.worldObj.spawnEntityInWorld(fx);
}
bulletnt.worldObj.spawnEntityInWorld(pippo);
bulletnt.worldObj.playSoundEffect(pippo.posX, pippo.posY + 50, pippo.posZ, "hbm:alarm.trainHorn", 100F, 1F);
}
};
@ -311,29 +297,22 @@ public class Gun44MagnumFactory {
bullet.wear = 25;
bullet.doesPenetrate = false;
bullet.bHit = new IBulletHitBehavior() {
@Override
public void behaveEntityHit(EntityBulletBase bullet, Entity hit) {
bullet.bntHit = (bulletnt, hit) -> {
if(!bullet.worldObj.isRemote) {
EntityDuchessGambit pippo = new EntityDuchessGambit(bullet.worldObj);
pippo.posX = hit.posX;
pippo.posY = hit.posY + 50;
pippo.posZ = hit.posZ;
for(int j = 0; j < 150; j++) {
EntityBSmokeFX fx = new EntityBSmokeFX(bullet.worldObj, pippo.posX + (bullet.worldObj.rand.nextDouble() - 0.5) * 7, pippo.posY + (bullet.worldObj.rand.nextDouble() - 0.5) * 8, pippo.posZ + (bullet.worldObj.rand.nextDouble() - 0.5) * 18, 0, 0, 0);
bullet.worldObj.spawnEntityInWorld(fx);
}
bullet.worldObj.spawnEntityInWorld(pippo);
bullet.worldObj.playSoundEffect(pippo.posX,
pippo.posY + 50,
pippo.posZ, "hbm:weapon.boat", 100F, 1F);
if(!bulletnt.worldObj.isRemote) {
EntityDuchessGambit pippo = new EntityDuchessGambit(bulletnt.worldObj);
pippo.posX = hit.posX;
pippo.posY = hit.posY + 50;
pippo.posZ = hit.posZ;
for(int j = 0; j < 150; j++) {
EntityBSmokeFX fx = new EntityBSmokeFX(bulletnt.worldObj, pippo.posX + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 7, pippo.posY + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 8, pippo.posZ + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 18, 0, 0, 0);
bulletnt.worldObj.spawnEntityInWorld(fx);
}
bulletnt.worldObj.spawnEntityInWorld(pippo);
bulletnt.worldObj.playSoundEffect(pippo.posX, pippo.posY + 50, pippo.posZ, "hbm:weapon.boat", 100F, 1F);
}
};
bullet.spentCasing = CASING44.clone().register("44BJ").setColor(0x632B2C);
@ -351,29 +330,22 @@ public class Gun44MagnumFactory {
bullet.wear = 25;
bullet.doesPenetrate = false;
bullet.bHit = new IBulletHitBehavior() {
@Override
public void behaveEntityHit(EntityBulletBase bullet, Entity hit) {
bullet.bntHit = (bulletnt, hit) -> {
if(!bullet.worldObj.isRemote) {
EntityBuilding pippo = new EntityBuilding(bullet.worldObj);
pippo.posX = hit.posX;
pippo.posY = hit.posY + 50;
pippo.posZ = hit.posZ;
for(int j = 0; j < 150; j++) {
EntityBSmokeFX fx = new EntityBSmokeFX(bullet.worldObj, pippo.posX + (bullet.worldObj.rand.nextDouble() - 0.5) * 15, pippo.posY + (bullet.worldObj.rand.nextDouble() - 0.5) * 15, pippo.posZ + (bullet.worldObj.rand.nextDouble() - 0.5) * 15, 0, 0, 0);
bullet.worldObj.spawnEntityInWorld(fx);
}
bullet.worldObj.spawnEntityInWorld(pippo);
bullet.worldObj.playSoundEffect(pippo.posX,
pippo.posY + 50,
pippo.posZ, "hbm:block.debris", 100F, 1F);
if(!bulletnt.worldObj.isRemote) {
EntityBuilding pippo = new EntityBuilding(bulletnt.worldObj);
pippo.posX = hit.posX;
pippo.posY = hit.posY + 50;
pippo.posZ = hit.posZ;
for(int j = 0; j < 150; j++) {
EntityBSmokeFX fx = new EntityBSmokeFX(bulletnt.worldObj, pippo.posX + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 15, pippo.posY + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 15, pippo.posZ + (bulletnt.worldObj.rand.nextDouble() - 0.5) * 15, 0, 0, 0);
bulletnt.worldObj.spawnEntityInWorld(fx);
}
bulletnt.worldObj.spawnEntityInWorld(pippo);
bulletnt.worldObj.playSoundEffect(pippo.posX, pippo.posY + 50, pippo.posZ, "hbm:block.debris", 100F, 1F);
}
};
bullet.spentCasing = CASING44.clone().register("44Silver").setColor(0x2B5963);

View File

@ -3,7 +3,7 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import java.util.List;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionNT;
import com.hbm.explosion.ExplosionNT.ExAttrib;
@ -12,9 +12,6 @@ import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.CasingEjector;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletHurtBehavior;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.ItemAmmoEnums.Ammo4Gauge;
@ -33,7 +30,6 @@ import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -209,19 +205,15 @@ public class Gun4GaugeFactory {
bullet.effects = new ArrayList();
bullet.effects.add(new PotionEffect(eff));
bullet.bImpact = new IBulletImpactBehavior() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
}
bullet.bntImpact = (bulletnt, x, y, z) -> {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50));
};
bullet.spentCasing = CASING4GAUGE.clone().register("4GaPhos").setColor(0xF6871A, SpentCasing.COLOR_CASE_4GA);
@ -259,22 +251,18 @@ public class Gun4GaugeFactory {
bullet.trail = 1;
bullet.explosive = 0.0F;
bullet.bImpact = new IBulletImpactBehavior() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
if(bullet.worldObj.isRemote)
return;
ExplosionNT explosion = new ExplosionNT(bullet.worldObj, null, bullet.posX, bullet.posY, bullet.posZ, 4);
explosion.atttributes.add(ExAttrib.ALLDROP);
explosion.atttributes.add(ExAttrib.NOHURT);
explosion.doExplosionA();
explosion.doExplosionB(false);
ExplosionLarge.spawnParticles(bullet.worldObj, bullet.posX, bullet.posY, bullet.posZ, 15);
}
bullet.bntImpact = (bulletnt, x, y, z) -> {
if(bulletnt.worldObj.isRemote)
return;
ExplosionNT explosion = new ExplosionNT(bulletnt.worldObj, null, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 4);
explosion.atttributes.add(ExAttrib.ALLDROP);
explosion.atttributes.add(ExAttrib.NOHURT);
explosion.doExplosionA();
explosion.doExplosionB(false);
ExplosionLarge.spawnParticles(bulletnt.worldObj, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 15);
};
bullet.spentCasing = CASING4GAUGE.clone().register("4GaSem").setColor(0x5C5C5C, SpentCasing.COLOR_CASE_4GA);
@ -295,21 +283,17 @@ public class Gun4GaugeFactory {
bullet.trail = 1;
bullet.explosive = 0.0F;
bullet.bImpact = new IBulletImpactBehavior() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
if(bullet.worldObj.isRemote)
return;
ExplosionNT explosion = new ExplosionNT(bullet.worldObj, null, bullet.posX, bullet.posY, bullet.posZ, 6);
explosion.atttributes.add(ExAttrib.BALEFIRE);
explosion.doExplosionA();
explosion.doExplosionB(false);
ExplosionLarge.spawnParticles(bullet.worldObj, bullet.posX, bullet.posY, bullet.posZ, 30);
}
bullet.bntImpact = (bulletnt, x, y, z) -> {
if(bulletnt.worldObj.isRemote)
return;
ExplosionNT explosion = new ExplosionNT(bulletnt.worldObj, null, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 6);
explosion.atttributes.add(ExAttrib.BALEFIRE);
explosion.doExplosionA();
explosion.doExplosionB(false);
ExplosionLarge.spawnParticles(bulletnt.worldObj, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 30);
};
bullet.spentCasing = CASING4GAUGE.clone().register("4GaBale").setColor(0x7BFF44, SpentCasing.COLOR_CASE_4GA);
@ -348,23 +332,20 @@ public class Gun4GaugeFactory {
bullet.trail = 4;
bullet.vPFX = "smoke";
bullet.bUpdate = new IBulletUpdateBehavior() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
bullet.bntUpdate = (bulletnt) -> {
if(!bulletnt.worldObj.isRemote) {
if(!bullet.worldObj.isRemote) {
if(bulletnt.ticksExisted > 10) {
bulletnt.setDead();
if(bullet.ticksExisted > 10) {
bullet.setDead();
for(int i = 0; i < 50; i++) {
for(int i = 0; i < 50; i++) {
EntityBulletBase bolt = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.M44_AP);
bolt.setPosition(bullet.posX, bullet.posY, bullet.posZ);
bolt.setThrowableHeading(bullet.motionX, bullet.motionY, bullet.motionZ, 0.25F, 0.1F);
bullet.worldObj.spawnEntityInWorld(bolt);
}
EntityBulletBaseNT bolt = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.M44_AP);
bolt.setPosition(bulletnt.posX, bulletnt.posY, bulletnt.posZ);
bolt.setThrowableHeading(bulletnt.motionX, bulletnt.motionY, bulletnt.motionZ, 0.25F, 0.1F);
bolt.setThrower(bulletnt.getThrower());
bulletnt.worldObj.spawnEntityInWorld(bolt);
}
}
}
@ -397,25 +378,21 @@ public class Gun4GaugeFactory {
bullet.bulletsMax *= 2;
bullet.leadChance = 100;
bullet.bHurt = new IBulletHurtBehavior() {
@Override
public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) {
bullet.bntHurt = (bulletnt, hit) -> {
if(bulletnt.worldObj.isRemote)
return;
if(hit instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) hit;
float f = living.getHealth();
if(bullet.worldObj.isRemote)
return;
if(hit instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) hit;
float f = living.getHealth();
if(f > 0) {
f = Math.max(0, f - 2);
living.setHealth(f);
if(f > 0) {
f = Math.max(0, f - 2);
living.setHealth(f);
if(f == 0)
living.onDeath(ModDamageSource.causeBulletDamage(bullet, hit));
}
if(f == 0)
living.onDeath(ModDamageSource.causeBulletDamage(bulletnt, hit));
}
}
};
@ -437,25 +414,21 @@ public class Gun4GaugeFactory {
bullet.leadChance = 100;
bullet.style = BulletConfiguration.STYLE_FLECHETTE;
bullet.bHurt = new IBulletHurtBehavior() {
bullet.bntHurt = (bulletnt, hit) -> {
@Override
public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) {
if(bullet.worldObj.isRemote)
return;
if(hit instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) hit;
IExtendedEntityProperties prop = player.getExtendedProperties("WitcheryExtendedPlayer");
NBTTagCompound blank = new NBTTagCompound();
blank.setTag("WitcheryExtendedPlayer", new NBTTagCompound());
if(prop != null) {
prop.loadNBTData(blank);
}
if(bulletnt.worldObj.isRemote)
return;
if(hit instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) hit;
IExtendedEntityProperties prop = player.getExtendedProperties("WitcheryExtendedPlayer");
NBTTagCompound blank = new NBTTagCompound();
blank.setTag("WitcheryExtendedPlayer", new NBTTagCompound());
if(prop != null) {
prop.loadNBTData(blank);
}
}
};
@ -476,20 +449,16 @@ public class Gun4GaugeFactory {
bullet.bulletsMax *= 2;
bullet.leadChance = 0;
bullet.bHurt = new IBulletHurtBehavior() {
bullet.bntHurt = (bulletnt, hit) -> {
if(bulletnt.worldObj.isRemote)
return;
@Override
public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) {
if(bullet.worldObj.isRemote)
return;
if(hit instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) hit;
player.inventory.dropAllItems();
player.worldObj.newExplosion(bullet.shooter, player.posX, player.posY, player.posZ, 5.0F, true, true);
}
if(hit instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) hit;
player.inventory.dropAllItems();
player.worldObj.newExplosion(bulletnt.getThrower(), player.posX, player.posY, player.posZ, 5.0F, true, true);
}
};
@ -512,27 +481,20 @@ public class Gun4GaugeFactory {
bullet.trail = 4;
bullet.vPFX = "explode";
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = (bulletnt) -> {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
if(!bullet.worldObj.isRemote) {
if(bullet.ticksExisted % 2 == 0) {
List<EntityCreature> creatures = bullet.worldObj.getEntitiesWithinAABB(EntityCreature.class, bullet.boundingBox.expand(10, 10, 10));
for(EntityCreature creature : creatures) {
if(creature.getClass().getCanonicalName().startsWith("net.minecraft.entity.titan")) {
BulletConfigFactory.nuclearExplosion(creature, 0, 0, 0, ExplosionNukeSmall.PARAMS_TOTS);
if(!bulletnt.worldObj.isRemote) {
if(bulletnt.ticksExisted % 2 == 0) {
bullet.worldObj.removeEntity(creature);
bullet.worldObj.unloadEntities(new ArrayList() {{ add(creature); }});
}
List<EntityCreature> creatures = bulletnt.worldObj.getEntitiesWithinAABB(EntityCreature.class, bulletnt.boundingBox.expand(10, 10, 10));
for(EntityCreature creature : creatures) {
if(creature.getClass().getCanonicalName().startsWith("net.minecraft.entity.titan")) {
BulletConfigFactory.nuclearExplosion(creature, 0, 0, 0, ExplosionNukeSmall.PARAMS_TOTS);
bulletnt.worldObj.removeEntity(creature);
bulletnt.worldObj.unloadEntities(new ArrayList() {{ add(creature); }});
}
}
}
}

View File

@ -2,13 +2,11 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.CasingEjector;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletHitBehavior;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.ItemAmmoEnums.Ammo50BMG;
@ -31,7 +29,6 @@ import com.hbm.util.ContaminationUtil.ContaminationType;
import com.hbm.util.ContaminationUtil.HazardType;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
@ -65,7 +62,7 @@ public class Gun50BMGFactory {
bullet.leadChance = 20;
bullet.blockDamage = false;
bullet.bImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 2.0F, false, false);
bullet.bntImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 2.0F, false, false);
bullet.spentCasing = CASINGLUNA.clone().register("LunaStock");
@ -79,7 +76,7 @@ public class Gun50BMGFactory {
bullet.ammo.meta = 1;
bullet.incendiary = 10;
bullet.bImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 5.0F, true, false);
bullet.bntImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 5.0F, true, false);
bullet.spentCasing = CASINGLUNA.clone().register("LunaInc");
@ -94,7 +91,7 @@ public class Gun50BMGFactory {
bullet.ammo.meta = 2;
bullet.explosive = 25;
bullet.destroysBlocks = true;
bullet.bImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 25.0F, true, false);
bullet.bntImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 25.0F, true, false);
bullet.spentCasing = CASINGLUNA.clone().register("LunaExp");
@ -267,19 +264,15 @@ public class Gun50BMGFactory {
bullet.effects = new ArrayList();
bullet.effects.add(new PotionEffect(eff));
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = (bulletnt, x, y, z) -> {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
}
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50));
};
bullet.spentCasing = CASING50BMG.clone().register("50BMGPhos");
@ -363,39 +356,31 @@ public class Gun50BMGFactory {
bullet.leadChance = 100;
bullet.doesPenetrate = false;
bullet.bHit = new IBulletHitBehavior() {
bullet.bntHit = (bulletnt, hit) -> {
@Override
public void behaveEntityHit(EntityBulletBase bullet, Entity hit) {
if(bullet.worldObj.isRemote)
return;
EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ);
meteor.motionY = -1D;
meteor.shooter = bullet.shooter;
bullet.worldObj.spawnEntityInWorld(meteor);
}
if(bulletnt.worldObj.isRemote)
return;
EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ);
meteor.motionY = -1D;
meteor.setThrower(bulletnt.getThrower());
bulletnt.worldObj.spawnEntityInWorld(meteor);
};
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = (bulletnt, x, y, z) -> {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
if(bullet.worldObj.isRemote)
return;
if(y == -1)
return;
EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(bullet.posX, bullet.posY + 30 + meteor.worldObj.rand.nextInt(10), bullet.posZ);
meteor.motionY = -1D;
meteor.shooter = bullet.shooter;
bullet.worldObj.spawnEntityInWorld(meteor);
}
if(bulletnt.worldObj.isRemote)
return;
if(y == -1)
return;
EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(bulletnt.posX, bulletnt.posY + 30 + meteor.worldObj.rand.nextInt(10), bulletnt.posZ);
meteor.motionY = -1D;
meteor.setThrower(bulletnt.getThrower());
bulletnt.worldObj.spawnEntityInWorld(meteor);
};
bullet.spentCasing = CASING50BMG.clone().register("50BMGIF");
@ -428,17 +413,13 @@ public class Gun50BMGFactory {
bullet.dmgMax = 64;
bullet.style = bullet.STYLE_FLECHETTE;
bullet.bHit = new IBulletHitBehavior() {
bullet.bntHit = (bulletnt, hit) -> {
@Override
public void behaveEntityHit(EntityBulletBase bullet, Entity hit) {
if(bullet.worldObj.isRemote)
return;
if(hit instanceof EntityLivingBase) {
ContaminationUtil.contaminate((EntityLivingBase) hit, HazardType.RADIATION, ContaminationType.RAD_BYPASS, 100F);
}
if(bulletnt.worldObj.isRemote)
return;
if(hit instanceof EntityLivingBase) {
ContaminationUtil.contaminate((EntityLivingBase) hit, HazardType.RADIATION, ContaminationType.RAD_BYPASS, 100F);
}
};
@ -457,17 +438,13 @@ public class Gun50BMGFactory {
bullet.dmgMax = 64;
bullet.style = bullet.STYLE_FLECHETTE;
bullet.bHit = new IBulletHitBehavior() {
bullet.bntHit = (bulletnt, hit) -> {
@Override
public void behaveEntityHit(EntityBulletBase bullet, Entity hit) {
if(bullet.worldObj.isRemote)
return;
if(hit instanceof EntityLivingBase) {
ContaminationUtil.contaminate((EntityLivingBase) hit, HazardType.RADIATION, ContaminationType.RAD_BYPASS, 50F);
}
if(bulletnt.worldObj.isRemote)
return;
if(hit instanceof EntityLivingBase) {
ContaminationUtil.contaminate((EntityLivingBase) hit, HazardType.RADIATION, ContaminationType.RAD_BYPASS, 50F);
}
};

View File

@ -2,13 +2,11 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.CasingEjector;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletHitBehavior;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ItemAmmoEnums.Ammo556mm;
import com.hbm.items.ModItems;
@ -26,7 +24,6 @@ import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
@ -185,19 +182,15 @@ public class Gun556mmFactory {
bullet.effects = new ArrayList();
bullet.effects.add(new PotionEffect(eff));
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = (bulletnt, x, y, z) -> {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
}
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50));
};
bullet.spentCasing = CASING556.clone().register("556Phos");
@ -261,39 +254,31 @@ public class Gun556mmFactory {
bullet.leadChance = 100;
bullet.doesPenetrate = false;
bullet.bHit = new IBulletHitBehavior() {
bullet.bntHit = (bulletnt, hit) -> {
@Override
public void behaveEntityHit(EntityBulletBase bullet, Entity hit) {
if(bullet.worldObj.isRemote)
return;
EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ);
meteor.motionY = -1D;
meteor.shooter = bullet.shooter;
bullet.worldObj.spawnEntityInWorld(meteor);
}
if(bulletnt.worldObj.isRemote)
return;
EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ);
meteor.motionY = -1D;
meteor.setThrower(bulletnt.getThrower());
bulletnt.worldObj.spawnEntityInWorld(meteor);
};
bullet.bImpact = new IBulletImpactBehavior() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
if(bullet.worldObj.isRemote)
return;
if(y == -1)
return;
EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(bullet.posX, bullet.posY + 30 + meteor.worldObj.rand.nextInt(10), bullet.posZ);
meteor.motionY = -1D;
meteor.shooter = bullet.shooter;
bullet.worldObj.spawnEntityInWorld(meteor);
}
bullet.bntImpact = (bulletnt, x, y, z) -> {
if(bulletnt.worldObj.isRemote)
return;
if(y == -1)
return;
EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(bulletnt.posX, bulletnt.posY + 30 + meteor.worldObj.rand.nextInt(10), bulletnt.posZ);
meteor.motionY = -1D;
meteor.setThrower(bulletnt.getThrower());
bulletnt.worldObj.spawnEntityInWorld(meteor);
};
bullet.spentCasing = CASING556.clone().register("556IF");
@ -355,19 +340,15 @@ public class Gun556mmFactory {
bullet.effects = new ArrayList();
bullet.effects.add(new PotionEffect(eff));
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = (bulletnt, x, y, z) -> {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
}
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50));
};
bullet.spentCasing = CASING556.clone().register("556FlecPhos");
@ -402,39 +383,31 @@ public class Gun556mmFactory {
bullet.leadChance = 50;
bullet.doesPenetrate = false;
bullet.bHit = new IBulletHitBehavior() {
bullet.bntHit = (bulletnt, hit) -> {
@Override
public void behaveEntityHit(EntityBulletBase bullet, Entity hit) {
if(bullet.worldObj.isRemote)
return;
EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ);
meteor.motionY = -1D;
meteor.shooter = bullet.shooter;
bullet.worldObj.spawnEntityInWorld(meteor);
}
if(bulletnt.worldObj.isRemote)
return;
EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(hit.posX, hit.posY + 30 + meteor.worldObj.rand.nextInt(10), hit.posZ);
meteor.motionY = -1D;
meteor.setThrower(bulletnt.getThrower());
bulletnt.worldObj.spawnEntityInWorld(meteor);
};
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = (bulletnt, x, y, z) -> {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
if(bullet.worldObj.isRemote)
return;
if(y == -1)
return;
EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(bullet.posX, bullet.posY + 30 + meteor.worldObj.rand.nextInt(10), bullet.posZ);
meteor.motionY = -1D;
meteor.shooter = bullet.shooter;
bullet.worldObj.spawnEntityInWorld(meteor);
}
if(bulletnt.worldObj.isRemote)
return;
if(y == -1)
return;
EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(bulletnt.posX, bulletnt.posY + 30 + meteor.worldObj.rand.nextInt(10), bulletnt.posZ);
meteor.motionY = -1D;
meteor.setThrower(bulletnt.getThrower());
bulletnt.worldObj.spawnEntityInWorld(meteor);
};
bullet.spentCasing = CASING556.clone().register("556FlecIF");

View File

@ -2,11 +2,8 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletHurtBehavior;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ItemAmmoEnums.Ammo75Bolt;
import com.hbm.items.ModItems;
@ -23,7 +20,6 @@ import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
@ -96,25 +92,21 @@ public class Gun75BoltFactory {
bullet.doesRicochet = false;
bullet.explosive = 0.25F;
bullet.bHurt = new IBulletHurtBehavior() {
bullet.bntHurt = (bulletnt, hit) -> {
@Override
public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) {
if(bullet.worldObj.isRemote)
return;
if(hit instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) hit;
float f = living.getHealth();
if(f > 0) {
f = Math.max(0, f - 2);
living.setHealth(f);
if(f == 0)
living.onDeath(ModDamageSource.lead);
}
if(bulletnt.worldObj.isRemote)
return;
if(hit instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) hit;
float f = living.getHealth();
if(f > 0) {
f = Math.max(0, f - 2);
living.setHealth(f);
if(f == 0)
living.onDeath(ModDamageSource.lead);
}
}
};
@ -142,19 +134,15 @@ public class Gun75BoltFactory {
bullet.effects = new ArrayList();
bullet.effects.add(new PotionEffect(eff));
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = (bulletnt, x, y, z) -> {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ), new TargetPoint(bullet.dimension, bullet.posX, bullet.posY, bullet.posZ, 50));
}
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setString("mode", "flame");
data.setInteger("count", 15);
data.setDouble("motion", 0.05D);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ), new TargetPoint(bulletnt.dimension, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 50));
};
return bullet;

View File

@ -1,9 +1,7 @@
package com.hbm.handler.guncfg;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.explosion.ExplosionNukeSmall;
import com.hbm.handler.BulletConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ItemAmmoEnums.Ammo240Shell;
import com.hbm.items.ModItems;
@ -86,12 +84,8 @@ public class GunCannonFactory {
bullet.dmgMin = 100;
bullet.dmgMax = 150;
bullet.bImpact = new IBulletImpactBehavior() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_TOTS);
}
bullet.bntImpact = (bulletnt, x, y, z) -> {
BulletConfigFactory.nuclearExplosion(bulletnt, x, y, z, ExplosionNukeSmall.PARAMS_TOTS);
};
bullet.spentCasing = CASINNG240MM;

View File

@ -2,12 +2,10 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletHurtBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ItemAmmoEnums.AmmoDart;
import com.hbm.items.ModItems;
@ -16,7 +14,6 @@ import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.main.MainRegistry;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
@ -103,27 +100,23 @@ public class GunDartFactory {
bullet.effects = new ArrayList();
bullet.effects.add(new PotionEffect(Potion.wither.id, 60 * 20, 2));
bullet.bHurt = new IBulletHurtBehavior() {
bullet.bntHurt = (bulletnt, hit) -> {
@Override
public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) {
if(bullet.worldObj.isRemote)
if(bulletnt.worldObj.isRemote)
return;
if(hit instanceof EntityPlayer) {
if(((EntityPlayer) hit).inventory.hasItem(ModItems.ingot_meteorite_forged))
return;
if(hit instanceof EntityPlayer) {
if(((EntityPlayer) hit).inventory.hasItem(ModItems.ingot_meteorite_forged))
return;
if(bullet.shooter instanceof EntityPlayer) {
EntityPlayer shooter = (EntityPlayer) bullet.shooter;
if(shooter.getHeldItem() != null && shooter.getHeldItem().getItem() == ModItems.gun_darter) {
ItemGunDart.writePlayer(shooter.getHeldItem(), (EntityPlayer)hit);
shooter.playSound("random.orb", 1.0F, 1.0F);
}
if(bulletnt.getThrower() instanceof EntityPlayer) {
EntityPlayer shooter = (EntityPlayer) bulletnt.getThrower();
if(shooter.getHeldItem() != null && shooter.getHeldItem().getItem() == ModItems.gun_darter) {
ItemGunDart.writePlayer(shooter.getHeldItem(), (EntityPlayer) hit);
shooter.playSound("random.orb", 1.0F, 1.0F);
}
}
}
@ -146,23 +139,19 @@ public class GunDartFactory {
bullet.style = bullet.STYLE_FLECHETTE;
bullet.leadChance = 0;
bullet.bHurt = new IBulletHurtBehavior() {
bullet.bntHurt = (bulletnt, hit) -> {
@Override
public void behaveEntityHurt(EntityBulletBase bullet, Entity hit) {
if(bullet.worldObj.isRemote)
return;
if(hit instanceof EntityLivingBase) {
EntityLivingBase e = (EntityLivingBase) hit;
if(bulletnt.worldObj.isRemote)
return;
if(HbmLivingProps.getRadiation(e) < 250)
HbmLivingProps.setRadiation(e, 250);
if(HbmLivingProps.getTimer(e) <= 0)
HbmLivingProps.setTimer(e, MainRegistry.polaroidID * 60 * 20);
}
if(hit instanceof EntityLivingBase) {
EntityLivingBase e = (EntityLivingBase) hit;
if(HbmLivingProps.getRadiation(e) < 250)
HbmLivingProps.setRadiation(e, 250);
if(HbmLivingProps.getTimer(e) <= 0)
HbmLivingProps.setTimer(e, MainRegistry.polaroidID * 60 * 20);
}
};

View File

@ -2,14 +2,12 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBomb;
import com.hbm.interfaces.IBomb.BombReturnCode;
import com.hbm.main.MainRegistry;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
import com.hbm.packet.PacketDispatcher;
@ -90,22 +88,20 @@ public class GunDetonatorFactory {
bullet.doesRicochet = false;
bullet.setToBolt(BulletConfiguration.BOLT_LASER);
bullet.bImpact = new IBulletImpactBehavior() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
bullet.bntImpact = (bulletnt, x, y, z) -> {
World world = bullet.worldObj;
if(!world.isRemote && y > 0) {
Block b = world.getBlock(x, y, z);
if(b instanceof IBomb) {
BombReturnCode ret = ((IBomb)b).explode(world, x, y, z);
if(ret.wasSuccessful() && bullet.shooter instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP) bullet.shooter;
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(ret.getUnlocalizedMessage()).color(EnumChatFormatting.YELLOW).flush(), MainRegistry.proxy.ID_DETONATOR), (EntityPlayerMP) player);
}
World world = bulletnt.worldObj;
if(!world.isRemote && y > 0) {
Block b = world.getBlock(x, y, z);
if(b instanceof IBomb) {
BombReturnCode ret = ((IBomb) b).explode(world, x, y, z);
if(ret.wasSuccessful() && bulletnt.getThrower() instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP) bulletnt.getThrower();
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
PacketDispatcher.wrapper.sendTo(
new PlayerInformPacket(ChatBuilder.start("").nextTranslation(ret.getUnlocalizedMessage()).color(EnumChatFormatting.YELLOW).flush(), MainRegistry.proxy.ID_DETONATOR),
(EntityPlayerMP) player);
}
}
}

View File

@ -3,14 +3,14 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.entity.projectile.EntityBulletBaseNT.IBulletImpactBehaviorNT;
import com.hbm.entity.projectile.EntityBulletBaseNT.IBulletUpdateBehaviorNT;
import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ItemAmmoEnums.AmmoFireExt;
import com.hbm.items.ItemAmmoEnums.AmmoFlamethrower;
@ -326,10 +326,10 @@ public class GunEnergyFactory {
bullet.dmgProj = false;
bullet.dmgFire = true;
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
if(!bullet.worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();
@ -373,7 +373,7 @@ public class GunEnergyFactory {
bullet.maxAge = 200;
bullet.vPFX = "smoke";
bullet.bImpact = BulletConfigFactory.getPhosphorousEffect(5, 60 * 20, 25, 0.25, 0.1F);
bullet.bntImpact = BulletConfigFactory.getPhosphorousEffect(5, 60 * 20, 25, 0.25, 0.1F);
return bullet;
}
@ -420,7 +420,7 @@ public class GunEnergyFactory {
bullet.dmgFire = false;
bullet.bImpact = BulletConfigFactory.getGasEffect(5, 60 * 20);
bullet.bntImpact = BulletConfigFactory.getGasEffect(5, 60 * 20);
return bullet;
}
@ -447,12 +447,12 @@ public class GunEnergyFactory {
bullet.style = BulletConfiguration.STYLE_NONE;
bullet.plink = BulletConfiguration.PLINK_NONE;
bullet.bHurt = (bulletEntity, target) -> { target.extinguish(); };
bullet.bntHurt = (bulletEntity, target) -> { target.extinguish(); };
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
if(!bullet.worldObj.isRemote) {
@ -485,10 +485,10 @@ public class GunEnergyFactory {
}
};
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote) {
@ -527,10 +527,10 @@ public class GunEnergyFactory {
bullet.ammo = new ComparableStack(ModItems.ammo_fireext.stackFromEnum(AmmoFireExt.FOAM));
bullet.spread = 0.05F;
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
if(!bullet.worldObj.isRemote) {
@ -582,10 +582,10 @@ public class GunEnergyFactory {
}
};
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote) {
@ -614,12 +614,12 @@ public class GunEnergyFactory {
bullet.ammo = new ComparableStack(ModItems.ammo_fireext.stackFromEnum(AmmoFireExt.SAND));
bullet.spread = 0.1F;
bullet.bHurt = null; // does not extinguish entities
bullet.bntHurt = null; // does not extinguish entities
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
if(!bullet.worldObj.isRemote) {
@ -655,10 +655,10 @@ public class GunEnergyFactory {
}
};
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote) {
@ -707,10 +707,10 @@ public class GunEnergyFactory {
bullet.effects = new ArrayList();
bullet.effects.add(new PotionEffect(HbmPotion.bang.id, 10 * 20, 0));
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
if(!bullet.worldObj.isRemote) {
ExplosionChaos.explodeZOMG(bullet.worldObj, (int)Math.floor(bullet.posX), (int)Math.floor(bullet.posY), (int)Math.floor(bullet.posZ), 5);

View File

@ -3,7 +3,8 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.entity.projectile.EntityBulletBaseNT.*;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionNT;
import com.hbm.explosion.ExplosionNukeSmall;
@ -12,8 +13,6 @@ import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.ItemAmmoEnums.AmmoFatman;
@ -133,10 +132,10 @@ public class GunFatmanFactory {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.STOCK));
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_MEDIUM);
}
};
@ -149,10 +148,10 @@ public class GunFatmanFactory {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.LOW));
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_LOW);
}
};
@ -165,10 +164,10 @@ public class GunFatmanFactory {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.HIGH));
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_HIGH);
}
};
@ -185,10 +184,10 @@ public class GunFatmanFactory {
bullet.spread = 0.1F;
bullet.style = bullet.STYLE_GRENADE;
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_TOTS);
}
};
@ -201,10 +200,10 @@ public class GunFatmanFactory {
BulletConfiguration bullet = BulletConfigFactory.standardNukeConfig();
bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.SAFE));
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_SAFE);
}
};
@ -218,10 +217,10 @@ public class GunFatmanFactory {
bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.PUMPKIN));
bullet.explosive = 10F;
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
if(!bullet.worldObj.isRemote) {
@ -250,10 +249,10 @@ public class GunFatmanFactory {
bullet.explosive = 3F;
bullet.style = bullet.STYLE_BARREL;
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
if(!bullet.worldObj.isRemote) {
@ -308,10 +307,10 @@ public class GunFatmanFactory {
bullet.style = BulletConfiguration.STYLE_MIRV;
bullet.velocity *= 3;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote)
return;
@ -321,7 +320,7 @@ public class GunFatmanFactory {
for(int i = 0; i < 6; i++) {
EntityBulletBase nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_NORMAL);
EntityBulletBaseNT nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_NORMAL);
nuke.setPosition(bullet.posX, bullet.posY, bullet.posZ);
double mod = 0.1D;
nuke.motionX = bullet.worldObj.rand.nextGaussian() * mod;
@ -345,10 +344,10 @@ public class GunFatmanFactory {
bullet.style = BulletConfiguration.STYLE_MIRV;
bullet.velocity *= 3;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote)
return;
@ -358,7 +357,7 @@ public class GunFatmanFactory {
for(int i = 0; i < 6; i++) {
EntityBulletBase nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_LOW);
EntityBulletBaseNT nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_LOW);
nuke.setPosition(bullet.posX, bullet.posY, bullet.posZ);
double mod = 0.1D;
nuke.motionX = bullet.worldObj.rand.nextGaussian() * mod;
@ -382,10 +381,10 @@ public class GunFatmanFactory {
bullet.style = BulletConfiguration.STYLE_MIRV;
bullet.velocity *= 3;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote)
return;
@ -395,7 +394,7 @@ public class GunFatmanFactory {
for(int i = 0; i < 6; i++) {
EntityBulletBase nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_HIGH);
EntityBulletBaseNT nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_HIGH);
nuke.setPosition(bullet.posX, bullet.posY, bullet.posZ);
double mod = 0.1D;
nuke.motionX = bullet.worldObj.rand.nextGaussian() * mod;
@ -419,10 +418,10 @@ public class GunFatmanFactory {
bullet.style = BulletConfiguration.STYLE_MIRV;
bullet.velocity *= 3;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote)
return;
@ -432,7 +431,7 @@ public class GunFatmanFactory {
for(int i = 0; i < 6; i++) {
EntityBulletBase nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_SAFE);
EntityBulletBaseNT nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_SAFE);
nuke.setPosition(bullet.posX, bullet.posY, bullet.posZ);
double mod = 0.1D;
nuke.motionX = bullet.worldObj.rand.nextGaussian() * mod;
@ -456,10 +455,10 @@ public class GunFatmanFactory {
bullet.style = BulletConfiguration.STYLE_MIRV;
bullet.velocity *= 3;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote)
return;
@ -469,16 +468,16 @@ public class GunFatmanFactory {
for(int i = 0; i < 24; i++) {
EntityBulletBase nuke = null;
EntityBulletBaseNT nuke = null;
if(i < 6)
nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_LOW);
nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_LOW);
else if(i < 12)
nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_TOTS);
nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_TOTS);
else if(i < 18)
nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_NORMAL);
nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_NORMAL);
else
nuke = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.NUKE_AMAT);
nuke = new EntityBulletBaseNT(bullet.worldObj, BulletConfigSyncingUtil.NUKE_AMAT);
nuke.setPosition(bullet.posX, bullet.posY, bullet.posZ);
@ -503,8 +502,8 @@ public class GunFatmanFactory {
bullet.ammo = new ComparableStack(ModItems.ammo_nuke.stackFromEnum(AmmoFatman.BALEFIRE));
bullet.style = BulletConfiguration.STYLE_BF;
bullet.bImpact = new IBulletImpactBehavior() {
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
bullet.bntImpact = new IBulletImpactBehaviorNT() {
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
if(!bullet.worldObj.isRemote) {

View File

@ -2,13 +2,11 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.explosion.ExplosionNukeSmall;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.CasingEjector;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.ItemAmmoEnums.AmmoGrenade;
@ -131,7 +129,7 @@ public class GunGrenadeFactory {
bullet.trail = 0;
bullet.incendiary = 2;
bullet.bImpact = BulletConfigFactory.getPhosphorousEffect(10, 60 * 20, 100, 0.5D, 1F);
bullet.bntImpact = BulletConfigFactory.getPhosphorousEffect(10, 60 * 20, 100, 0.5D, 1F);
bullet.spentCasing = CASING40MM.clone().register("40MMPhos");
@ -213,12 +211,8 @@ public class GunGrenadeFactory {
bullet.velocity = 4;
bullet.explosive = 0.0F;
bullet.bImpact = new IBulletImpactBehavior() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_TOTS);
}
bullet.bntImpact = (bulletnt, x, y, z) -> {
BulletConfigFactory.nuclearExplosion(bulletnt, x, y, z, ExplosionNukeSmall.PARAMS_TOTS);
};
bullet.spentCasing = CASING40MM.clone().register("40MMNuke");

View File

@ -3,12 +3,11 @@ package com.hbm.handler.guncfg;
import java.util.List;
import java.util.Random;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.entity.projectile.EntityBulletBaseNT.IBulletUpdateBehaviorNT;
import com.hbm.explosion.ExplosionNukeGeneric;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.lib.ModDamageSource;
@ -51,30 +50,26 @@ public class GunNPCFactory {
bullet.trail = 1;
bullet.explosive = 1.5F;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = (bulletnt) -> {
if(bulletnt.worldObj.isRemote)
return;
@Override
public void behaveUpdate(EntityBulletBase bullet) {
if(bullet.worldObj.isRemote)
return;
if(bullet.ticksExisted % 10 != 5)
return;
List<EntityPlayer> players = bullet.worldObj.getEntitiesWithinAABB(EntityPlayer.class, bullet.boundingBox.expand(50, 50, 50));
for(EntityPlayer player : players) {
Vec3 motion = Vec3.createVectorHelper(player.posX - bullet.posX, (player.posY + player.getEyeHeight()) - bullet.posY, player.posZ - bullet.posZ);
motion = motion.normalize();
EntityBulletBase bolt = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_BOLT);
bolt.shooter = bullet.shooter;
bolt.setPosition(bullet.posX, bullet.posY, bullet.posZ);
bolt.setThrowableHeading(motion.xCoord, motion.yCoord, motion.zCoord, 0.5F, 0.05F);
bullet.worldObj.spawnEntityInWorld(bolt);
}
if(bulletnt.ticksExisted % 10 != 5)
return;
List<EntityPlayer> players = bulletnt.worldObj.getEntitiesWithinAABB(EntityPlayer.class, bulletnt.boundingBox.expand(50, 50, 50));
for(EntityPlayer player : players) {
Vec3 motion = Vec3.createVectorHelper(player.posX - bulletnt.posX, (player.posY + player.getEyeHeight()) - bulletnt.posY, player.posZ - bulletnt.posZ);
motion = motion.normalize();
EntityBulletBaseNT bolt = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_BOLT);
bolt.setThrower(bulletnt.getThrower());
bolt.setPosition(bulletnt.posX, bulletnt.posY, bulletnt.posZ);
bolt.setThrowableHeading(motion.xCoord, motion.yCoord, motion.zCoord, 0.5F, 0.05F);
bulletnt.worldObj.spawnEntityInWorld(bolt);
}
};
@ -129,20 +124,16 @@ public class GunNPCFactory {
bullet.vPFX = "reddust";
bullet.damageType = ModDamageSource.s_laser;
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = (bulletnt, x, y, z) -> {
if(bulletnt.worldObj.isRemote)
return;
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
if(bullet.worldObj.isRemote)
return;
EntityBulletBase meteor = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(bullet.posX, bullet.posY + 30 + meteor.worldObj.rand.nextInt(10), bullet.posZ);
meteor.motionY = -1D;
meteor.shooter = bullet.shooter;
bullet.worldObj.spawnEntityInWorld(meteor);
}
EntityBulletBaseNT meteor = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.MASKMAN_METEOR);
meteor.setPosition(bulletnt.posX, bulletnt.posY + 30 + meteor.worldObj.rand.nextInt(10), bulletnt.posZ);
meteor.motionY = -1D;
meteor.setThrower(bulletnt.getThrower());
bulletnt.worldObj.spawnEntityInWorld(meteor);
};
return bullet;
@ -178,25 +169,21 @@ public class GunNPCFactory {
bullet.explosive = 2.5F;
bullet.style = BulletConfiguration.STYLE_METEOR;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = (bulletnt) -> {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
if(!bullet.worldObj.isRemote)
return;
Random rand = bullet.worldObj.rand;
for(int i = 0; i < 5; i++) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("type", "vanillaExt");
nbt.setString("mode", "flame");
nbt.setDouble("posX", bullet.posX + rand.nextDouble() * 0.5 - 0.25);
nbt.setDouble("posY", bullet.posY + rand.nextDouble() * 0.5 - 0.25);
nbt.setDouble("posZ", bullet.posZ + rand.nextDouble() * 0.5 - 0.25);
MainRegistry.proxy.effectNT(nbt);
}
if(!bulletnt.worldObj.isRemote)
return;
Random rand = bulletnt.worldObj.rand;
for(int i = 0; i < 5; i++) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("type", "vanillaExt");
nbt.setString("mode", "flame");
nbt.setDouble("posX", bulletnt.posX + rand.nextDouble() * 0.5 - 0.25);
nbt.setDouble("posY", bulletnt.posY + rand.nextDouble() * 0.5 - 0.25);
nbt.setDouble("posZ", bulletnt.posZ + rand.nextDouble() * 0.5 - 0.25);
MainRegistry.proxy.effectNT(nbt);
}
};
@ -245,13 +232,13 @@ public class GunNPCFactory {
bullet.destroysBlocks = false;
bullet.explosive = 0F;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = new IBulletUpdateBehaviorNT() {
double angle = 90;
double range = 100;
@Override
public void behaveUpdate(EntityBulletBase bullet) {
public void behaveUpdate(EntityBulletBaseNT bullet) {
if(bullet.worldObj.isRemote)
return;
@ -265,7 +252,7 @@ public class GunNPCFactory {
if(target != null) {
if(bullet.getDistanceSqToEntity(target) < 5) {
bullet.getConfig().bImpact.behaveBlockHit(bullet, -1, -1, -1);
bullet.getConfig().bntImpact.behaveBlockHit(bullet, -1, -1, -1);
bullet.setDead();
return;
}
@ -281,7 +268,7 @@ public class GunNPCFactory {
}
}
private void chooseTarget(EntityBulletBase bullet) {
private void chooseTarget(EntityBulletBaseNT bullet) {
List<EntityLivingBase> entities = bullet.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bullet.boundingBox.expand(range, range, range));
@ -292,7 +279,7 @@ public class GunNPCFactory {
for(EntityLivingBase e : entities) {
if(!e.isEntityAlive() || e == bullet.shooter)
if(!e.isEntityAlive() || e == bullet.getThrower())
continue;
Vec3 delta = Vec3.createVectorHelper(e.posX - bullet.posX, e.posY + e.height / 2 - bullet.posY, e.posZ - bullet.posZ);
@ -319,27 +306,23 @@ public class GunNPCFactory {
}
};
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = (bulletnt, x, y, z) -> {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
bulletnt.worldObj.playSoundEffect(bulletnt.posX, bulletnt.posY, bulletnt.posZ, "hbm:entity.ufoBlast", 5.0F, 0.9F + bulletnt.worldObj.rand.nextFloat() * 0.2F);
bulletnt.worldObj.playSoundEffect(bulletnt.posX, bulletnt.posY, bulletnt.posZ, "fireworks.blast", 5.0F, 0.5F);
ExplosionNukeGeneric.dealDamage(bulletnt.worldObj, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 10, 50);
bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "hbm:entity.ufoBlast", 5.0F, 0.9F + bullet.worldObj.rand.nextFloat() * 0.2F);
bullet.worldObj.playSoundEffect(bullet.posX, bullet.posY, bullet.posZ, "fireworks.blast", 5.0F, 0.5F);
ExplosionNukeGeneric.dealDamage(bullet.worldObj, bullet.posX, bullet.posY, bullet.posZ, 10, 50);
for(int i = 0; i < 3; i++) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "plasmablast");
data.setFloat("r", 0.0F);
data.setFloat("g", 0.75F);
data.setFloat("b", 1.0F);
data.setFloat("pitch", -30F + 30F * i);
data.setFloat("yaw", bullet.worldObj.rand.nextFloat() * 180F);
data.setFloat("scale", 5F);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bullet.posX, bullet.posY, bullet.posZ),
new TargetPoint(bullet.worldObj.provider.dimensionId, bullet.posX, bullet.posY, bullet.posZ, 100));
}
for(int i = 0; i < 3; i++) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "plasmablast");
data.setFloat("r", 0.0F);
data.setFloat("g", 0.75F);
data.setFloat("b", 1.0F);
data.setFloat("pitch", -30F + 30F * i);
data.setFloat("yaw", bulletnt.worldObj.rand.nextFloat() * 180F);
data.setFloat("scale", 5F);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, bulletnt.posX, bulletnt.posY, bulletnt.posZ),
new TargetPoint(bulletnt.worldObj.provider.dimensionId, bulletnt.posX, bulletnt.posY, bulletnt.posZ, 100));
}
};

View File

@ -101,17 +101,17 @@ public class GunOSIPRFactory {
bullet.maxAge = 150;
bullet.velocity = 2;
bullet.bHurt = (ball, entity) -> {
bullet.bntHurt = (ball, entity) -> {
if(entity instanceof EntityLivingBase) {
EntityLivingBase entityLiving = (EntityLivingBase) entity;
entity.addVelocity(ball.motionX / 2, ball.motionY / 2, ball.motionZ / 2);
if(entity == ball.shooter)
if(entity == ball.getThrower())
return;
if(entityLiving.getHealth() <= 1000) {
entityLiving.addPotionEffect(new PotionEffect(HbmPotion.bang.id, 1, 0));
entityLiving.setLastAttacker(ball.shooter);
entityLiving.setLastAttacker(ball.getThrower());
} else if(entityLiving.getHealth() > 1000) {
ball.setDead();
return;
@ -120,14 +120,14 @@ public class GunOSIPRFactory {
}
};
bullet.bRicochet = (ball, x, y, z) -> {
bullet.bntRicochet = (ball, x, y, z) -> {
Block block = ball.worldObj.getBlock(x, y, z);
if(block instanceof RedBarrel)
((RedBarrel) block).explode(ball.worldObj, x, y, z);
};
bullet.bImpact = (ball, x, y, z) -> {
bullet.bntImpact = (ball, x, y, z) -> {
final Block block = ball.worldObj.getBlock(x, y, z);
if(block instanceof RedBarrel)
((RedBarrel) block).explode(ball.worldObj, x, y, z);

View File

@ -3,14 +3,11 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.entity.effect.EntitySpear;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.explosion.ExplosionNukeSmall;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.interfaces.IBulletRicochetBehavior;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.ItemAmmoEnums.AmmoRocket;
@ -287,12 +284,8 @@ public class GunRocketFactory {
bullet.incendiary = 0;
bullet.trail = 7;
bullet.bImpact = new IBulletImpactBehavior() {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_MEDIUM);
}
bullet.bntImpact = (bulletnt, x, y, z) -> {
BulletConfigFactory.nuclearExplosion(bulletnt, x, y, z, ExplosionNukeSmall.PARAMS_MEDIUM);
};
return bullet;
@ -331,18 +324,14 @@ public class GunRocketFactory {
bullet.LBRC = 100;
bullet.doesPenetrate = true;
bullet.bRicochet = new IBulletRicochetBehavior() {
bullet.bntRicochet = (bulletnt, bX, bY, bZ) -> {
World worldObj = bulletnt.worldObj;
if(!worldObj.isRemote && (worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.wood ||
worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.plants ||
worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.glass ||
worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.leaves))
worldObj.func_147480_a(bX, bY, bZ, false);
@Override
public void behaveBlockRicochet(EntityBulletBase bullet, int bX, int bY, int bZ) {
World worldObj = bullet.worldObj;
if(!worldObj.isRemote &&
(worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.wood ||
worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.plants ||
worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.glass ||
worldObj.getBlock(bX, bY, bZ).getMaterial() == Material.leaves))
worldObj.func_147480_a(bX, bY, bZ, false);}
};
return bullet;
@ -360,7 +349,7 @@ public class GunRocketFactory {
bullet.incendiary = 5;
bullet.trail = 9;
bullet.bImpact = BulletConfigFactory.getPhosphorousEffect(10, 60 * 20, 100, 0.5D, 1F);
bullet.bntImpact = BulletConfigFactory.getPhosphorousEffect(10, 60 * 20, 100, 0.5D, 1F);
return bullet;
}
@ -375,23 +364,16 @@ public class GunRocketFactory {
bullet.explosive = 2F;
bullet.trail = 0;
bullet.bUpdate = new IBulletUpdateBehavior() {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
if(!bullet.worldObj.isRemote) {
if(bullet.ticksExisted > 10) {
bullet.setDead();
for(int i = 0; i < 50; i++) {
EntityBulletBase bolt = new EntityBulletBase(bullet.worldObj, BulletConfigSyncingUtil.M44_AP);
bolt.setPosition(bullet.posX, bullet.posY, bullet.posZ);
bolt.setThrowableHeading(bullet.motionX, bullet.motionY, bullet.motionZ, 0.25F, 0.1F);
bullet.worldObj.spawnEntityInWorld(bolt);
}
bullet.bntUpdate = (bulletnt) -> {
if(!bulletnt.worldObj.isRemote) {
if(bulletnt.ticksExisted > 10) {
bulletnt.setDead();
for(int i = 0; i < 50; i++) {
EntityBulletBaseNT bolt = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.M44_AP);
bolt.setPosition(bulletnt.posX, bulletnt.posY, bulletnt.posZ);
bolt.setThrowableHeading(bulletnt.motionX, bulletnt.motionY, bulletnt.motionZ, 0.25F, 0.1F);
bolt.setThrower(bulletnt.getThrower());
bulletnt.worldObj.spawnEntityInWorld(bolt);
}
}
}
@ -413,21 +395,17 @@ public class GunRocketFactory {
bullet.incendiary = 0;
bullet.trail = 7;
bullet.bImpact = new IBulletImpactBehavior() {
bullet.bntImpact = (bulletnt, x, y, z) -> {
@Override
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z) {
if(bullet.worldObj.isRemote)
return;
EntitySpear spear = new EntitySpear(bullet.worldObj);
spear.posX = bullet.posX;
spear.posZ = bullet.posZ;
spear.posY = bullet.posY + 100;
bullet.worldObj.spawnEntityInWorld(spear);
}
if(bulletnt.worldObj.isRemote)
return;
EntitySpear spear = new EntitySpear(bulletnt.worldObj);
spear.posX = bulletnt.posX;
spear.posZ = bulletnt.posZ;
spear.posY = bulletnt.posY + 100;
bulletnt.worldObj.spawnEntityInWorld(spear);
};
return bullet;

View File

@ -2,12 +2,10 @@ package com.hbm.handler.guncfg;
import java.util.ArrayList;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityRocketHoming;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBulletUpdateBehavior;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ItemAmmoEnums.AmmoStinger;
import com.hbm.items.ModItems;
@ -98,28 +96,24 @@ GunConfiguration config = new GunConfiguration();
bullet.explosive = 4F;
bullet.trail = 0;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = (bulletnt) -> {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
if(!bullet.worldObj.isRemote) {
EntityPlayer player = bullet.worldObj.getClosestPlayerToEntity(bullet, -1.0D);
EntityRocketHoming rocket = new EntityRocketHoming(bullet.worldObj, player, 1.0F, 5.0F, 0);
if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) {
EntityRocketHoming rocket2 = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 0);
rocket = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 0);
rocket.setIsCritical(true);
rocket2.setIsCritical(true);
bullet.worldObj.spawnEntityInWorld(rocket2);
}
rocket.homingMod = 5;
rocket.homingRadius = 25;
bullet.worldObj.spawnEntityInWorld(rocket);
bullet.setDead();
if(!bulletnt.worldObj.isRemote) {
EntityPlayer player = bulletnt.worldObj.getClosestPlayerToEntity(bulletnt, -1.0D);
EntityRocketHoming rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.0F, 5.0F, 0);
if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) {
EntityRocketHoming rocket2 = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 0);
rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 0);
rocket.setIsCritical(true);
rocket2.setIsCritical(true);
bulletnt.worldObj.spawnEntityInWorld(rocket2);
}
rocket.homingMod = 5;
rocket.homingRadius = 25;
bulletnt.worldObj.spawnEntityInWorld(rocket);
bulletnt.setDead();
}
};
return bullet;
@ -135,28 +129,24 @@ GunConfiguration config = new GunConfiguration();
bullet.trail = 0;
bullet.wear = 15;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = (bulletnt) -> {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
if(!bullet.worldObj.isRemote) {
EntityPlayer player = bullet.worldObj.getClosestPlayerToEntity(bullet, -1.0D);
EntityRocketHoming rocket = new EntityRocketHoming(bullet.worldObj, player, 1.0F, 5.0F, 1);
if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) {
EntityRocketHoming rocket2 = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 1);
rocket = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 1);
rocket.setIsCritical(true);
rocket2.setIsCritical(true);
bullet.worldObj.spawnEntityInWorld(rocket2);
}
rocket.homingMod = 5;
rocket.homingRadius = 25;
bullet.worldObj.spawnEntityInWorld(rocket);
bullet.setDead();
if(!bulletnt.worldObj.isRemote) {
EntityPlayer player = bulletnt.worldObj.getClosestPlayerToEntity(bulletnt, -1.0D);
EntityRocketHoming rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.0F, 5.0F, 1);
if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) {
EntityRocketHoming rocket2 = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 1);
rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 1);
rocket.setIsCritical(true);
rocket2.setIsCritical(true);
bulletnt.worldObj.spawnEntityInWorld(rocket2);
}
rocket.homingMod = 5;
rocket.homingRadius = 25;
bulletnt.worldObj.spawnEntityInWorld(rocket);
bulletnt.setDead();
}
};
return bullet;
@ -172,28 +162,24 @@ GunConfiguration config = new GunConfiguration();
bullet.trail = 0;
bullet.wear = 12;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = (bulletnt) -> {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
if(!bullet.worldObj.isRemote) {
EntityPlayer player = bullet.worldObj.getClosestPlayerToEntity(bullet, -1.0D);
EntityRocketHoming rocket = new EntityRocketHoming(bullet.worldObj, player, 1.0F, 5.0F, 2);
if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) {
EntityRocketHoming rocket2 = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 2);
rocket = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 2);
rocket.setIsCritical(true);
rocket2.setIsCritical(true);
bullet.worldObj.spawnEntityInWorld(rocket2);
}
rocket.homingMod = 5;
rocket.homingRadius = 25;
bullet.worldObj.spawnEntityInWorld(rocket);
bullet.setDead();
if(!bulletnt.worldObj.isRemote) {
EntityPlayer player = bulletnt.worldObj.getClosestPlayerToEntity(bulletnt, -1.0D);
EntityRocketHoming rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.0F, 5.0F, 2);
if(player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) {
EntityRocketHoming rocket2 = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 2);
rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 2);
rocket.setIsCritical(true);
rocket2.setIsCritical(true);
bulletnt.worldObj.spawnEntityInWorld(rocket2);
}
rocket.homingMod = 5;
rocket.homingRadius = 25;
bulletnt.worldObj.spawnEntityInWorld(rocket);
bulletnt.setDead();
}
};
return bullet;
@ -209,31 +195,27 @@ GunConfiguration config = new GunConfiguration();
bullet.trail = 0;
bullet.wear = 30;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = (bulletnt) -> {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
if(!bulletnt.worldObj.isRemote) {
if(!bullet.worldObj.isRemote) {
EntityPlayer player = bulletnt.worldObj.getClosestPlayerToEntity(bulletnt, -1.0D);
EntityPlayer player = bullet.worldObj.getClosestPlayerToEntity(bullet, -1.0D);
if(player.getDistanceToEntity(bullet) < 16) {
EntityRocketHoming rocket = new EntityRocketHoming(bullet.worldObj, player, 1.0F, 5.0F, 4);
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) {
EntityRocketHoming rocket2 = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 4);
rocket = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 4);
rocket.setIsCritical(true);
rocket2.setIsCritical(true);
bullet.worldObj.spawnEntityInWorld(rocket2);
}
rocket.homingMod = 5;
rocket.homingRadius = 25;
bullet.worldObj.spawnEntityInWorld(rocket);
if(player.getDistanceToEntity(bulletnt) < 16) {
EntityRocketHoming rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.0F, 5.0F, 4);
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) {
EntityRocketHoming rocket2 = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 4);
rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 4);
rocket.setIsCritical(true);
rocket2.setIsCritical(true);
bulletnt.worldObj.spawnEntityInWorld(rocket2);
}
bullet.setDead();
rocket.homingMod = 5;
rocket.homingRadius = 25;
bulletnt.worldObj.spawnEntityInWorld(rocket);
}
bulletnt.setDead();
}
};
return bullet;
@ -248,31 +230,27 @@ GunConfiguration config = new GunConfiguration();
bullet.explosive = 8F;
bullet.trail = 0;
bullet.bUpdate = new IBulletUpdateBehavior() {
bullet.bntUpdate = (bulletnt) -> {
@Override
public void behaveUpdate(EntityBulletBase bullet) {
if(!bulletnt.worldObj.isRemote) {
if(!bullet.worldObj.isRemote) {
EntityPlayer player = bulletnt.worldObj.getClosestPlayerToEntity(bulletnt, -1.0D);
EntityPlayer player = bullet.worldObj.getClosestPlayerToEntity(bullet, -1.0D);
if(player.getDistanceToEntity(bullet) < 16) {
EntityRocketHoming rocket = new EntityRocketHoming(bullet.worldObj, player, 1.0F, 5.0F, 42);
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) {
EntityRocketHoming rocket2 = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 42);
rocket = new EntityRocketHoming(bullet.worldObj, player, 1.5F, 15.0F, 42);
rocket.setIsCritical(true);
rocket2.setIsCritical(true);
bullet.worldObj.spawnEntityInWorld(rocket2);
}
rocket.homingMod = 5;
rocket.homingRadius = 25;
bullet.worldObj.spawnEntityInWorld(rocket);
if(player.getDistanceToEntity(bulletnt) < 16) {
EntityRocketHoming rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.0F, 5.0F, 42);
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.gun_skystinger && !player.isSneaking()) {
EntityRocketHoming rocket2 = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 42);
rocket = new EntityRocketHoming(bulletnt.worldObj, player, 1.5F, 15.0F, 42);
rocket.setIsCritical(true);
rocket2.setIsCritical(true);
bulletnt.worldObj.spawnEntityInWorld(rocket2);
}
bullet.setDead();
rocket.homingMod = 5;
rocket.homingRadius = 25;
bulletnt.worldObj.spawnEntityInWorld(rocket);
}
bulletnt.setDead();
}
};
return bullet;

View File

@ -1,12 +0,0 @@
package com.hbm.interfaces;
import com.hbm.entity.projectile.EntityBulletBase;
import net.minecraft.entity.Entity;
public interface IBulletHitBehavior {
//entity is hit, bullet dies
public void behaveEntityHit(EntityBulletBase bullet, Entity hit);
}

View File

@ -1,11 +0,0 @@
package com.hbm.interfaces;
import com.hbm.entity.projectile.EntityBulletBase;
import net.minecraft.entity.Entity;
public interface IBulletHurtBehavior {
//entity is hit
public void behaveEntityHurt(EntityBulletBase bullet, Entity hit);
}

View File

@ -1,11 +0,0 @@
package com.hbm.interfaces;
import com.hbm.entity.projectile.EntityBulletBase;
public interface IBulletImpactBehavior {
//block is hit, bullet dies
//also called when an entity is hit but with -1 coords, so beware
public void behaveBlockHit(EntityBulletBase bullet, int x, int y, int z);
}

View File

@ -1,10 +0,0 @@
package com.hbm.interfaces;
import com.hbm.entity.projectile.EntityBulletBase;
public interface IBulletRicochetBehavior {
//block is hit, bullet ricochets
public void behaveBlockRicochet(EntityBulletBase bullet, int x, int y, int z);
}

View File

@ -1,10 +0,0 @@
package com.hbm.interfaces;
import com.hbm.entity.projectile.EntityBulletBase;
public interface IBulletUpdateBehavior {
//once every update, for lcokon, steering and other memes
public void behaveUpdate(EntityBulletBase bullet);
}

View File

@ -5,13 +5,11 @@ import java.util.List;
import org.lwjgl.opengl.GL11;
import com.hbm.items.special.ItemBookLore.*;
import com.hbm.lib.RefStrings;
import com.hbm.util.I18nUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

View File

@ -2,8 +2,6 @@ package com.hbm.items.special;
import java.util.List;
import org.apache.commons.lang3.math.NumberUtils;
import com.hbm.inventory.gui.GUIBookLore;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;

View File

@ -1,7 +1,7 @@
package com.hbm.items.weapon;
import com.hbm.entity.particle.EntitySSmokeFX;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.interfaces.IHoldableWeapon;
import com.hbm.items.ModItems;
@ -63,7 +63,7 @@ public class GunFolly extends Item implements IHoldableWeapon {
player.motionZ -= player.getLookVec().zCoord * mult;
if (!world.isRemote) {
EntityBulletBase bullet = new EntityBulletBase(world, BulletConfigSyncingUtil.TEST_CONFIG, player);
EntityBulletBaseNT bullet = new EntityBulletBaseNT(world, BulletConfigSyncingUtil.TEST_CONFIG, player);
world.spawnEntityInWorld(bullet);
for(int i = 0; i < 25; i++) {

View File

@ -1,271 +0,0 @@
package com.hbm.items.weapon;
import java.util.List;
import java.util.Random;
import com.google.common.collect.Multimap;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.items.ModItems;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
public class GunLeverAction extends Item {
Random rand = new Random();
public int dmgMin = 8;
public int dmgMax = 16;
public GunLeverAction() {
this.maxStackSize = 1;
if(this == ModItems.gun_lever_action)
this.setMaxDamage(500);
if(this == ModItems.gun_lever_action_dark)
this.setMaxDamage(750);
}
/**
* called when the player releases the use item button. Args: itemstack,
* world, entityplayer, itemInUseCount
*/
@Override
public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) {
int j = this.getMaxItemUseDuration(p_77615_1_) - p_77615_4_;
ArrowLooseEvent event = new ArrowLooseEvent(p_77615_3_, p_77615_1_, j);
MinecraftForge.EVENT_BUS.post(event);
j = event.charge;
boolean flag = p_77615_3_.capabilities.isCreativeMode
|| EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0;
if (flag || p_77615_3_.inventory.hasItem(ModItems.ammo_20gauge)) {
float f = j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if (j < 10.0D) {
return;
}
if (j > 10.0F) {
f = 10.0F;
}
EntityBulletBase entityarrow1;
EntityBulletBase entityarrow2;
EntityBulletBase entityarrow3;
EntityBulletBase entityarrow4;
EntityBulletBase entityarrow5;
EntityBulletBase entityarrow6;
EntityBulletBase entityarrow7;
EntityBulletBase entityarrow8;
EntityBulletBase entityarrow9;
EntityBulletBase entityarrow10;
if (!p_77615_3_.isSneaking()) {
entityarrow1 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow2 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow3 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow4 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow5 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow6 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow7 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow8 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow9 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow10 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
} else {
entityarrow1 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow2 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow3 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow4 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow5 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow6 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow7 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow8 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow9 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
entityarrow10 = new EntityBulletBase(p_77615_2_, BulletConfigSyncingUtil.TEST_CONFIG, p_77615_3_);
}
p_77615_1_.damageItem(1, p_77615_3_);
p_77615_2_.playSoundAtEntity(p_77615_3_, "hbm:weapon.revolverShootAlt", 5.0F, 0.75F);
if (flag) { } else {
p_77615_3_.inventory.consumeInventoryItem(ModItems.ammo_20gauge);
}
if (!p_77615_2_.isRemote) {
p_77615_2_.spawnEntityInWorld(entityarrow1);
p_77615_2_.spawnEntityInWorld(entityarrow2);
p_77615_2_.spawnEntityInWorld(entityarrow3);
p_77615_2_.spawnEntityInWorld(entityarrow4);
if (!p_77615_3_.isSneaking()) {
p_77615_2_.spawnEntityInWorld(entityarrow5);
p_77615_2_.spawnEntityInWorld(entityarrow6);
int i = rand.nextInt(5);
if(i >= 1)
p_77615_2_.spawnEntityInWorld(entityarrow7);
if(i >= 2)
p_77615_2_.spawnEntityInWorld(entityarrow8);
if(i >= 3)
p_77615_2_.spawnEntityInWorld(entityarrow9);
if(i >= 4)
p_77615_2_.spawnEntityInWorld(entityarrow10);
}
}
setAnim(p_77615_1_, 1);
}
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean b) {
int j = getAnim(stack);
if(j > 0) {
if(j < 30)
setAnim(stack, j + 1);
else
setAnim(stack, 0);
if(j == 15)
world.playSoundAtEntity(entity, "hbm:weapon.leverActionReload", 2F, 0.85F);
}
}
@Override
public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_) {
return p_77654_1_;
}
/**
* How long it takes to use or consume an item
*/
@Override
public int getMaxItemUseDuration(ItemStack p_77626_1_) {
return 72000;
}
/**
* returns the action that specifies what animation to play when the items
* is being used
*/
@Override
public EnumAction getItemUseAction(ItemStack p_77661_1_) {
return EnumAction.bow;
}
/**
* Called whenever this item is equipped and the right mouse button is
* pressed. Args: itemStack, world, entityPlayer
*/
@Override
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_);
MinecraftForge.EVENT_BUS.post(event);
if(this.getAnim(p_77659_1_) == 0)
p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
return p_77659_1_;
}
/**
* Return the enchantability factor of the item, most of the time is based
* on material.
*/
@Override
public int getItemEnchantability() {
return 1;
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
if(this == ModItems.gun_lever_action)
list.add("Universal head-to-spaghetti-sauce converter.");
if(this == ModItems.gun_lever_action_dark)
list.add("Blow your legs off!");
list.add("");
list.add("Ammo: 12x74 Buckshot");
list.add("Damage: 8 - 16");
list.add("Projectiles: 6 - 10");
}
@Override
public Multimap getItemAttributeModifiers() {
Multimap multimap = super.getItemAttributeModifiers();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
new AttributeModifier(field_111210_e, "Weapon modifier", 3.5, 0));
return multimap;
}
private static int getAnim(ItemStack stack) {
if(stack.stackTagCompound == null) {
stack.stackTagCompound = new NBTTagCompound();
return 0;
}
return stack.stackTagCompound.getInteger("animation");
}
private static void setAnim(ItemStack stack, int i) {
if(stack.stackTagCompound == null) {
stack.stackTagCompound = new NBTTagCompound();
}
stack.stackTagCompound.setInteger("animation", i);
}
public static float getRotationFromAnim(ItemStack stack) {
float rad = 0.0174533F;
rad *= 7.5F;
int i = getAnim(stack);
if(i < 10)
return 0;
i -= 10;
if(i < 10)
return rad * i;
else
return (rad * 10) - (rad * (i - 10));
}
public static float getOffsetFromAnim(ItemStack stack) {
float i = getAnim(stack);
if(i < 10)
return 0;
i -= 10;
if(i < 10)
return i / 10;
else
return 2 - (i / 10);
}
}

View File

@ -1,129 +0,0 @@
package com.hbm.items.weapon;
import java.util.List;
import java.util.Random;
import com.google.common.collect.Multimap;
import com.hbm.entity.projectile.EntityBullet;
import com.hbm.entity.projectile.EntityCombineBall;
import com.hbm.items.ModItems;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
public class GunOSIPR extends Item {
Random rand = new Random();
public GunOSIPR()
{
this.maxStackSize = 1;
this.setMaxDamage(2500);
}
@Override
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
return EnumAction.bow;
}
@Override
public int getMaxItemUseDuration(ItemStack p_77626_1_) {
return 72000;
}
@Override
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
new ArrowNockEvent(p_77659_3_, p_77659_1_);
{
p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
}
return p_77659_1_;
}
@Override
public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
{
World world = player.worldObj;
if (!player.isSneaking()) {
boolean flag = player.capabilities.isCreativeMode
|| EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
if ((player.capabilities.isCreativeMode || player.inventory.hasItem(ModItems.gun_osipr_ammo)) && count % 3 == 0) {
EntityBullet entityarrow = new EntityBullet(world, player, 3.0F, 5, 15, false, "chopper");
entityarrow.setDamage(5 + rand.nextInt(10));
//world.playSoundAtEntity(player, "random.explode", 1.0F, 1.5F + (rand.nextFloat() / 4));
world.playSoundAtEntity(player, "hbm:weapon.osiprShoot", 1.0F, 0.8F + (rand.nextFloat() * 0.4F));
if (flag) {
entityarrow.canBePickedUp = 2;
} else {
player.inventory.consumeInventoryItem(ModItems.gun_osipr_ammo);
}
if (!world.isRemote) {
world.spawnEntityInWorld(entityarrow);
}
}
} else {
boolean flag = player.capabilities.isCreativeMode
|| EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
if ((player.capabilities.isCreativeMode || player.inventory.hasItem(ModItems.gun_osipr_ammo2)) && count % 30 == 0 && (this.getMaxItemUseDuration(stack) - count) != 0) {
EntityCombineBall entityarrow = new EntityCombineBall(player.worldObj, player, 3.0F);
entityarrow.setDamage(35 + rand.nextInt(45 - 35));
//world.playSoundAtEntity(player, "tile.piston.in", 1.0F, 0.75F);
world.playSoundAtEntity(player, "hbm:weapon.singFlyby", 1.0F, 1F);
if (flag) {
entityarrow.canBePickedUp = 2;
} else {
player.inventory.consumeInventoryItem(ModItems.gun_osipr_ammo2);
}
if (!world.isRemote) {
world.spawnEntityInWorld(entityarrow);
}
}
if((this.getMaxItemUseDuration(stack) - count) % 30 == 15 && (player.capabilities.isCreativeMode || player.inventory.hasItem(ModItems.gun_osipr_ammo2)))
world.playSoundAtEntity(player, "hbm:weapon.osiprCharging", 1.0F, 1F);
}
}
@Override
public int getItemEnchantability() {
return 0;
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
list.add("Hold right mouse button");
list.add("to shoot,");
list.add("sneak to shoot a");
list.add("dark energy ball!");
list.add("");
list.add("Ammo: Dark Energy Plugs");
list.add("Secondary Ammo: Combine Ball");
list.add("Damage: 5 - 15");
list.add("Secondary Damage: 1000");
}
@Override
public Multimap getItemAttributeModifiers() {
Multimap multimap = super.getItemAttributeModifiers();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
new AttributeModifier(field_111210_e, "Weapon modifier", 5, 0));
return multimap;
}
}

View File

@ -1,99 +0,0 @@
package com.hbm.items.weapon;
import java.util.List;
import java.util.Random;
import com.google.common.collect.Multimap;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.items.ModItems;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
public class GunSMG extends Item {
Random rand = new Random();
public GunSMG()
{
this.maxStackSize = 1;
}
@Override
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
return EnumAction.bow;
}
@Override
public int getMaxItemUseDuration(ItemStack p_77626_1_) {
return 72000;
}
@Override
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
new ArrowNockEvent(p_77659_3_, p_77659_1_);
{
p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
}
return p_77659_1_;
}
@Override
public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
{
World world = player.worldObj;
boolean flag = player.capabilities.isCreativeMode
|| EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
if ((player.capabilities.isCreativeMode || player.inventory.hasItem(ModItems.ammo_9mm))
&& count % 2 == 0) {
EntityBulletBase bullet = new EntityBulletBase(world, BulletConfigSyncingUtil.TEST_CONFIG, player);
//EntityArrow bullet = new EntityArrow(world, player, 3.0F);
//world.playSoundAtEntity(player, "random.explode", 1.0F, 1.5F + (rand.nextFloat() / 4));
world.playSoundAtEntity(player, "hbm:weapon.rifleShoot", 1.0F, 0.8F + (rand.nextFloat() * 0.4F));
if (flag) {
} else {
player.inventory.consumeInventoryItem(ModItems.ammo_9mm);
}
if (!world.isRemote) {
world.spawnEntityInWorld(bullet);
}
}
}
@Override
public int getItemEnchantability() {
return 0;
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
list.add("Ratatatatatatatata!!");
list.add("");
list.add("Ammo: SMG Round");
list.add("Damage: 2 - 8");
}
@Override
public Multimap getItemAttributeModifiers() {
Multimap multimap = super.getItemAttributeModifiers();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
new AttributeModifier(field_111210_e, "Weapon modifier", 3, 0));
return multimap;
}
}

View File

@ -1,187 +0,0 @@
package com.hbm.items.weapon;
import java.util.List;
import java.util.Random;
import com.google.common.collect.Multimap;
import com.hbm.entity.projectile.EntityBullet;
import com.hbm.items.ModItems;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
public class GunShotgun extends Item {
Random rand = new Random();
public int dmgMin = 3;
public int dmgMax = 7;
public GunShotgun() {
this.maxStackSize = 1;
if (this == ModItems.gun_uboinik) {
this.setMaxDamage(500);
}
}
/**
* called when the player releases the use item button. Args: itemstack,
* world, entityplayer, itemInUseCount
*/
@Override
public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) {
int j = this.getMaxItemUseDuration(p_77615_1_) - p_77615_4_;
ArrowLooseEvent event = new ArrowLooseEvent(p_77615_3_, p_77615_1_, j);
MinecraftForge.EVENT_BUS.post(event);
j = event.charge;
boolean flag = p_77615_3_.capabilities.isCreativeMode
|| EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0;
if (flag || p_77615_3_.inventory.hasItem(ModItems.ammo_12gauge)) {
float f = j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if (j < 10.0D) {
return;
}
if (j > 10.0F) {
f = 10.0F;
}
EntityBullet entityarrow1 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow1.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
EntityBullet entityarrow2 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow2.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
EntityBullet entityarrow3 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow3.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
EntityBullet entityarrow4 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow4.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
EntityBullet entityarrow5 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow5.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
EntityBullet entityarrow6 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow6.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
EntityBullet entityarrow7 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow7.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
EntityBullet entityarrow8 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow8.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
EntityBullet entityarrow9 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow9.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
EntityBullet entityarrow10 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow10.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
EntityBullet entityarrow11 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow11.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
EntityBullet entityarrow12 = new EntityBullet(p_77615_2_, p_77615_3_, 3.0F);
entityarrow12.setDamage(dmgMin + rand.nextInt(dmgMax - dmgMin));
p_77615_1_.damageItem(1, p_77615_3_);
p_77615_2_.playSoundAtEntity(p_77615_3_, "hbm:weapon.shotgunShoot", 1.0F, 1.0F);
if (flag) { } else {
p_77615_3_.inventory.consumeInventoryItem(ModItems.ammo_12gauge);
}
if (!p_77615_2_.isRemote) {
p_77615_2_.spawnEntityInWorld(entityarrow1);
p_77615_2_.spawnEntityInWorld(entityarrow2);
p_77615_2_.spawnEntityInWorld(entityarrow3);
p_77615_2_.spawnEntityInWorld(entityarrow4);
p_77615_2_.spawnEntityInWorld(entityarrow5);
p_77615_2_.spawnEntityInWorld(entityarrow6);
int i = rand.nextInt(7);
if(i >= 1)
p_77615_2_.spawnEntityInWorld(entityarrow7);
if(i >= 2)
p_77615_2_.spawnEntityInWorld(entityarrow8);
if(i >= 3)
p_77615_2_.spawnEntityInWorld(entityarrow9);
if(i >= 4)
p_77615_2_.spawnEntityInWorld(entityarrow10);
if(i >= 5)
p_77615_2_.spawnEntityInWorld(entityarrow11);
if(i >= 6)
p_77615_2_.spawnEntityInWorld(entityarrow12);
}
}
}
@Override
public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_) {
return p_77654_1_;
}
/**
* How long it takes to use or consume an item
*/
@Override
public int getMaxItemUseDuration(ItemStack p_77626_1_) {
return 72000;
}
/**
* returns the action that specifies what animation to play when the items
* is being used
*/
@Override
public EnumAction getItemUseAction(ItemStack p_77661_1_) {
return EnumAction.bow;
}
/**
* Called whenever this item is equipped and the right mouse button is
* pressed. Args: itemStack, world, entityPlayer
*/
@Override
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_);
MinecraftForge.EVENT_BUS.post(event);
p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));
return p_77659_1_;
}
/**
* Return the enchantability factor of the item, most of the time is based
* on material.
*/
@Override
public int getItemEnchantability() {
return 1;
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
//list.add("POW! Haha!");
list.add("Abracadabra Tomanakara!");
list.add("");
list.add("Ammo: 12x70 Buckshot");
list.add("Damage: 3 - 7");
list.add("Projectiles: 6 - 12");
}
@Override
public Multimap getItemAttributeModifiers() {
Multimap multimap = super.getItemAttributeModifiers();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
new AttributeModifier(field_111210_e, "Weapon modifier", 3.5, 0));
return multimap;
}
}

View File

@ -5,7 +5,6 @@ import java.util.List;
import org.lwjgl.input.Mouse;
import com.hbm.config.GeneralConfig;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;

View File

@ -1,6 +1,6 @@
package com.hbm.items.weapon;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.GunConfiguration;
import com.hbm.items.ModItems;
import com.hbm.lib.ModDamageSource;
@ -31,7 +31,7 @@ public class ItemGunGauss extends ItemGunBase {
}
if(!main && getStored(stack) > 0) {
EntityBulletBase bullet = new EntityBulletBase(world, altConfig.config.get(0), player);
EntityBulletBaseNT bullet = new EntityBulletBaseNT(world, altConfig.config.get(0), player);
bullet.overrideDamage = Math.max(getStored(stack), 1) * 10F;
world.spawnEntityInWorld(bullet);
world.playSoundAtEntity(player, "hbm:weapon.tauShoot", 0.5F, 0.75F);

View File

@ -5,7 +5,7 @@ import java.util.List;
import org.lwjgl.input.Mouse;
import com.hbm.config.GeneralConfig;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
@ -140,7 +140,7 @@ public class ItemEnergyGunBase extends ItemGunBase implements IBatteryItem {
protected void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) {
EntityBulletBase bullet = new EntityBulletBase(world, config, player);
EntityBulletBaseNT bullet = new EntityBulletBaseNT(world, config, player);
world.spawnEntityInWorld(bullet);
if(this.mainConfig.animations.containsKey(AnimType.CYCLE) && player instanceof EntityPlayerMP)

View File

@ -547,7 +547,6 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityRocket.class, new RenderSnowball(ModItems.man_core));
RenderingRegistry.registerEntityRenderingHandler(EntitySchrab.class, new RenderFlare());
RenderingRegistry.registerEntityRenderingHandler(EntityBullet.class, new RenderRocket());
RenderingRegistry.registerEntityRenderingHandler(EntityBulletBase.class, new RenderBullet());
RenderingRegistry.registerEntityRenderingHandler(EntityBulletBaseNT.class, new RenderBullet());
RenderingRegistry.registerEntityRenderingHandler(EntityRainbow.class, new RenderRainbow());
RenderingRegistry.registerEntityRenderingHandler(EntityNightmareBlast.class, new RenderOminousBullet());

View File

@ -27,7 +27,7 @@ import com.hbm.entity.mob.EntityDuck;
import com.hbm.entity.mob.EntityCreeperNuclear;
import com.hbm.entity.mob.EntityQuackos;
import com.hbm.entity.mob.EntityCreeperTainted;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.entity.projectile.EntityBurningFOEQ;
import com.hbm.entity.train.EntityRailCarBase;
import com.hbm.extprop.HbmLivingProps;
@ -844,7 +844,7 @@ public class ModEventHandler {
}
for(int i = 0; i < bullets; i++) {
EntityBulletBase bullet = new EntityBulletBase(player.worldObj, BulletConfigSyncingUtil.getKey(firedConfig), player);
EntityBulletBaseNT bullet = new EntityBulletBaseNT(player.worldObj, BulletConfigSyncingUtil.getKey(firedConfig), player);
player.worldObj.spawnEntityInWorld(bullet);
}

View File

@ -6,25 +6,15 @@ import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.render.loader.HFRWavefrontObject;
import com.hbm.render.util.HorsePronter;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
public class RendererObjTester extends TileEntitySpecialRenderer {
private static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/TestObj.obj");
//private static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/TestObj.obj");
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {

View File

@ -21,7 +21,6 @@ import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityFluidDuctSimple extends TileEntity implements IFluidDuct {
private FluidType lastType = Fluids.NONE;
protected FluidType type = Fluids.NONE;
public List<UnionOfTileEntitiesAndBooleansForFluids> uoteab = new ArrayList<UnionOfTileEntitiesAndBooleansForFluids>();

View File

@ -6,7 +6,7 @@ import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.TrappedBrick.Trap;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.entity.projectile.EntityRubble;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.items.ModItems;
@ -77,7 +77,7 @@ public class TileEntityTrappedBrick extends TileEntity {
worldObj.setBlock(xCoord, yCoord - 1 - i, zCoord, ModBlocks.concrete_pillar);
break;
case POISON_DART:
EntityBulletBase dart = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.G20_CAUSTIC);
EntityBulletBaseNT dart = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.G20_CAUSTIC);
dart.setPosition(xCoord + 0.5 + dir.offsetX, yCoord + 0.5, zCoord + 0.5 + dir.offsetZ);
dart.motionX = dir.offsetX;
dart.motionZ = dir.offsetZ;

View File

@ -10,7 +10,7 @@ import com.hbm.entity.logic.EntityBomber;
import com.hbm.entity.missile.EntityMissileBaseAdvanced;
import com.hbm.entity.missile.EntityMissileCustom;
import com.hbm.entity.missile.EntitySiegeDropship;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.entity.train.EntityRailCarBase;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
@ -356,7 +356,7 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple
vec.rotateAroundZ((float) -this.rotationPitch);
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
EntityBulletBase proj = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.getKey(bullet));
EntityBulletBaseNT proj = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.getKey(bullet));
proj.setPositionAndRotation(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord, 0.0F, 0.0F);
proj.setThrowableHeading(vec.xCoord, vec.yCoord, vec.zCoord, bullet.velocity, bullet.spread);

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.interfaces.IFluidAcceptor;
@ -113,7 +113,7 @@ public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFl
vec.rotateAroundZ((float) -this.rotationPitch);
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
EntityBulletBase proj = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.getKey(conf));
EntityBulletBaseNT proj = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.getKey(conf));
proj.setPositionAndRotation(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord, 0.0F, 0.0F);
proj.overrideDamage = (float) (trait.getHeatEnergy() / 500_000F);

View File

@ -3,7 +3,7 @@ package com.hbm.tileentity.turret;
import java.util.ArrayList;
import java.util.List;
import com.hbm.entity.projectile.EntityBulletBase;
import com.hbm.entity.projectile.EntityBulletBaseNT;
import com.hbm.handler.BulletConfigSyncingUtil;
import com.hbm.handler.BulletConfiguration;
import com.hbm.inventory.RecipesCommon.ComparableStack;
@ -155,7 +155,7 @@ public class TileEntityTurretRichard extends TileEntityTurretBaseNT {
vec.rotateAroundZ((float) -this.rotationPitch);
vec.rotateAroundY((float) -(this.rotationYaw + Math.PI * 0.5));
EntityBulletBase proj = new EntityBulletBase(worldObj, BulletConfigSyncingUtil.getKey(bullet));
EntityBulletBaseNT proj = new EntityBulletBaseNT(worldObj, BulletConfigSyncingUtil.getKey(bullet));
proj.setPositionAndRotation(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord, 0.0F, 0.0F);
proj.setThrowableHeading(vec.xCoord, vec.yCoord, vec.zCoord, bullet.velocity * 0.75F, bullet.spread);

View File

@ -2,8 +2,6 @@ package com.hbm.world.gen;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockNTMFlower.EnumFlowerType;
import com.hbm.config.StructureConfig;
import cpw.mods.fml.common.IWorldGenerator;
@ -13,7 +11,6 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.IChunkProvider;
import static net.minecraftforge.common.BiomeDictionary.*;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate;
import net.minecraftforge.event.terraingen.InitMapGenEvent.EventType;
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import static net.minecraftforge.event.terraingen.TerrainGen.*;