diff --git a/assets/hbm/lang/de_DE.lang b/assets/hbm/lang/de_DE.lang index a145ac93d..8010ce062 100644 --- a/assets/hbm/lang/de_DE.lang +++ b/assets/hbm/lang/de_DE.lang @@ -975,6 +975,7 @@ item.gun_lever_action.name=Mare's Leg (Original) item.gun_bolt_action.name=Dream-Repetiergewehr (Original) item.gun_lever_action_dark.name=Mare's Leg (Dunkel) item.gun_bolt_action_green.name=Dream-Repetiergewehr (Grün) +item.gun_b92.name=B92 Energiepistole item.gun_xvl1456.name=XVL1456 Tau-Kanone Prototyp item.gun_osipr.name=Standartausrüstung für Sicherheitskräfte item.gun_immolator.name=Der Immolator diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index 87eec71cb..cc321e613 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -978,6 +978,7 @@ item.gun_lever_action.name=Mare's Leg (Original) item.gun_bolt_action.name=Dream Bolt-Action Rifle (Original) item.gun_lever_action_dark.name=Mare's Leg (Dark) item.gun_bolt_action_green.name=Dream Bolt-Action Rifle (Green) +item.gun_b92.name=B92 Energy Pistol item.gun_xvl1456.name=XVL1456 Tau Cannon Prototype item.gun_osipr.name=Overwatch Standard Issue Pulse Rifle item.gun_immolator.name=The Immolator diff --git a/assets/hbm/sounds.json b/assets/hbm/sounds.json index 2f82fb37b..1f6996088 100644 --- a/assets/hbm/sounds.json +++ b/assets/hbm/sounds.json @@ -53,6 +53,7 @@ "weapon.sparkShoot": {"category": "player", "sounds": ["weapon/sparkShoot1", "weapon/sparkShoot2", "weapon/sparkShoot3"]}, "weapon.bang": {"category": "player", "sounds": [{"name": "weapon/bang", "stream": false}]}, "weapon.leverActionReload": {"category": "player", "sounds": [{"name": "weapon/leverActionReload", "stream": false}]}, + "weapon.b92Reload": {"category": "player", "sounds": [{"name": "weapon/b92Reload", "stream": false}]}, "weapon.reloadTurret": {"category": "player", "sounds": [{"name": "weapon/reloadTurret", "stream": false}]}, "weapon.switchmode1": {"category": "player", "sounds": [{"name": "weapon/switchmode1", "stream": false}]}, diff --git a/assets/hbm/sounds/weapon/b92Reload.ogg b/assets/hbm/sounds/weapon/b92Reload.ogg new file mode 100644 index 000000000..bcc60a9dc Binary files /dev/null and b/assets/hbm/sounds/weapon/b92Reload.ogg differ diff --git a/assets/hbm/textures/items/gun_b92.png b/assets/hbm/textures/items/gun_b92.png new file mode 100644 index 000000000..993ca5fdf Binary files /dev/null and b/assets/hbm/textures/items/gun_b92.png differ diff --git a/assets/hbm/textures/items/ingot_celneutronophyrium_new.png b/assets/hbm/textures/items/ingot_celneutronophyrium_new.png new file mode 100644 index 000000000..3a8ef7bc0 Binary files /dev/null and b/assets/hbm/textures/items/ingot_celneutronophyrium_new.png differ diff --git a/assets/hbm/textures/items/ingot_tetraneutronium_new.png b/assets/hbm/textures/items/ingot_tetraneutronium_new.png new file mode 100644 index 000000000..cdadfd3d7 Binary files /dev/null and b/assets/hbm/textures/items/ingot_tetraneutronium_new.png differ diff --git a/assets/hbm/textures/items/ingot_u238m2.png b/assets/hbm/textures/items/ingot_u238m2.png new file mode 100644 index 000000000..49e391c84 Binary files /dev/null and b/assets/hbm/textures/items/ingot_u238m2.png differ diff --git a/assets/hbm/textures/items/nugget_u238m2.png b/assets/hbm/textures/items/nugget_u238m2.png new file mode 100644 index 000000000..95a04822b Binary files /dev/null and b/assets/hbm/textures/items/nugget_u238m2.png differ diff --git a/assets/hbm/textures/models/ModelB92Dark.png b/assets/hbm/textures/models/ModelB92Dark.png new file mode 100644 index 000000000..db529adaf Binary files /dev/null and b/assets/hbm/textures/models/ModelB92Dark.png differ diff --git a/assets/hbm/textures/models/shimmer_sledge_wf.png b/assets/hbm/textures/models/shimmer_sledge_wf.png deleted file mode 100644 index 585c368d7..000000000 Binary files a/assets/hbm/textures/models/shimmer_sledge_wf.png and /dev/null differ diff --git a/assets/hbm/textures/models/tank_CRYOGEL.png b/assets/hbm/textures/models/tank_CRYOGEL.png new file mode 100644 index 000000000..38f82c090 Binary files /dev/null and b/assets/hbm/textures/models/tank_CRYOGEL.png differ diff --git a/com/hbm/entity/projectile/EntityExplosiveBeam.java b/com/hbm/entity/projectile/EntityExplosiveBeam.java new file mode 100644 index 000000000..cf2fb2b8b --- /dev/null +++ b/com/hbm/entity/projectile/EntityExplosiveBeam.java @@ -0,0 +1,514 @@ +package com.hbm.entity.projectile; + +import java.util.List; + +import com.hbm.entity.effect.EntityCloudFleija; +import com.hbm.entity.effect.EntityCloudFleijaRainbow; +import com.hbm.entity.grenade.EntityGrenadeZOMG; +import com.hbm.entity.logic.EntityNukeExplosionMK3; +import com.hbm.explosion.ExplosionChaos; +import com.hbm.explosion.ExplosionThermo; +import com.hbm.items.ModItems; +import com.hbm.lib.ModDamageSource; +import com.hbm.main.MainRegistry; + +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.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IProjectile; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.play.server.S2BPacketChangeGameState; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class EntityExplosiveBeam extends Entity implements IProjectile +{ + private int field_145791_d = -1; + private int field_145792_e = -1; + private int field_145789_f = -1; + public double gravity = 0.0D; + private Block field_145790_g; + private int inData; + private boolean inGround; + /** 1 if the player can pick up the arrow */ + public int canBePickedUp; + /** Seems to be some sort of timer for animating an arrow. */ + public int arrowShake; + /** The owner of this arrow. */ + public Entity shootingEntity; + private int ticksInGround; + private int ticksInAir; + private double damage = 2.0D; + /** The amount of knockback an arrow applies when it hits a mob. */ + private int knockbackStrength; + private static final String __OBFID = "CL_00001715"; + + + public EntityExplosiveBeam(World p_i1753_1_) + { + super(p_i1753_1_); + this.renderDistanceWeight = 10.0D; + this.setSize(0.5F, 0.5F); + } + + public EntityExplosiveBeam(World p_i1754_1_, double p_i1754_2_, double p_i1754_4_, double p_i1754_6_) + { + super(p_i1754_1_); + this.renderDistanceWeight = 10.0D; + this.setSize(0.5F, 0.5F); + this.setPosition(p_i1754_2_, p_i1754_4_, p_i1754_6_); + this.yOffset = 0.0F; + } + + public EntityExplosiveBeam(World p_i1755_1_, EntityLivingBase p_i1755_2_, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_) + { + super(p_i1755_1_); + this.renderDistanceWeight = 10.0D; + this.shootingEntity = p_i1755_2_; + + if (p_i1755_2_ instanceof EntityPlayer) + { + this.canBePickedUp = 1; + } + + this.posY = p_i1755_2_.posY + p_i1755_2_.getEyeHeight() - 0.10000000149011612D; + double d0 = p_i1755_3_.posX - p_i1755_2_.posX; + double d1 = p_i1755_3_.boundingBox.minY + p_i1755_3_.height / 3.0F - this.posY; + double d2 = p_i1755_3_.posZ - p_i1755_2_.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(p_i1755_2_.posX + d4, this.posY, p_i1755_2_.posZ + d5, f2, f3); + this.yOffset = 0.0F; + float f4 = (float)d3 * 0.2F; + this.setThrowableHeading(d0, d1 + f4, d2, p_i1755_4_, p_i1755_5_); + } + } + + public EntityExplosiveBeam(World p_i1756_1_, EntityLivingBase p_i1756_2_, float p_i1756_3_, int dmgMin, int dmgMax, EntityGrenadeZOMG grenade) { + super(p_i1756_1_); + this.renderDistanceWeight = 10.0D; + this.shootingEntity = p_i1756_2_; + + this.setSize(0.5F, 0.5F); + this.setLocationAndAngles(grenade.posX, grenade.posY + grenade.getEyeHeight(), grenade.posZ, + grenade.rotationYaw, grenade.rotationPitch); + this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; + this.posY -= 0.10000000149011612D; + this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + 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.setThrowableHeading(this.motionX, this.motionY, this.motionZ, p_i1756_3_ * 1.5F, 1.0F); + } + + public EntityExplosiveBeam(World p_i1756_1_, EntityLivingBase p_i1756_2_, float p_i1756_3_) + { + super(p_i1756_1_); + this.renderDistanceWeight = 10.0D; + this.shootingEntity = p_i1756_2_; + + this.setSize(0.5F, 0.5F); + this.setLocationAndAngles(p_i1756_2_.posX, p_i1756_2_.posY + p_i1756_2_.getEyeHeight(), p_i1756_2_.posZ, p_i1756_2_.rotationYaw, p_i1756_2_.rotationPitch); + this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F; + this.posY -= 0.10000000149011612D; + this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F; + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + 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.setThrowableHeading(this.motionX, this.motionY, this.motionZ, p_i1756_3_ * 1.5F, 1.0F); + } + + public EntityExplosiveBeam(World world, int x, int y, int z, double mx, double my, double mz, double grav) { + super(world); + this.posX = x + 0.5F; + this.posY = y + 0.5F; + this.posZ = z + 0.5F; + + this.motionX = mx; + this.motionY = my; + this.motionZ = mz; + + this.gravity = grav; + } + + @Override + protected void entityInit() + { + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + /** + * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction. + */ + @Override + public void setThrowableHeading(double p_70186_1_, double p_70186_3_, double p_70186_5_, float p_70186_7_, float p_70186_8_) + { + float f2 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_3_ * p_70186_3_ + p_70186_5_ * p_70186_5_); + p_70186_1_ /= f2; + p_70186_3_ /= f2; + p_70186_5_ /= f2; + p_70186_1_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.002499999832361937D * p_70186_8_; + p_70186_3_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.002499999832361937D * p_70186_8_; + p_70186_5_ += this.rand.nextGaussian() * (this.rand.nextBoolean() ? -1 : 1) * 0.002499999832361937D * p_70186_8_; + p_70186_1_ *= p_70186_7_; + p_70186_3_ *= p_70186_7_; + p_70186_5_ *= p_70186_7_; + this.motionX = p_70186_1_; + this.motionY = p_70186_3_; + this.motionZ = p_70186_5_; + float f3 = MathHelper.sqrt_double(p_70186_1_ * p_70186_1_ + p_70186_5_ * p_70186_5_); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70186_1_, p_70186_5_) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70186_3_, f3) * 180.0D / Math.PI); + this.ticksInGround = 0; + } + + /** + * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, + * posY, posZ, yaw, pitch + */ + @Override + @SideOnly(Side.CLIENT) + public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_) + { + this.setPosition(p_70056_1_, p_70056_3_, p_70056_5_); + this.setRotation(p_70056_7_, p_70056_8_); + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + @Override + @SideOnly(Side.CLIENT) + public void setVelocity(double p_70016_1_, double p_70016_3_, double p_70016_5_) + { + this.motionX = p_70016_1_; + this.motionY = p_70016_3_; + this.motionZ = p_70016_5_; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float f = MathHelper.sqrt_double(p_70016_1_ * p_70016_1_ + p_70016_5_ * p_70016_5_); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(p_70016_1_, p_70016_5_) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(p_70016_3_, 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); + this.ticksInGround = 0; + } + } + + /** + * Called to update the entity's position/logic. + */ + //@Override + @Override + public void onUpdate() + { + super.onUpdate(); + + if(this.ticksExisted > 100) + this.setDead(); + + 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); + } + + Block block = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f); + + if (block.getMaterial() != Material.air) + { + block.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f); + AxisAlignedBB axisalignedbb = block.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f); + if(!worldObj.isRemote) { + ExplosionChaos.burn(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 2); + ExplosionChaos.flameDeath(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 5); + ExplosionThermo.scorchLight(this.worldObj, (int)this.posX, (int)this.posY, (int)this.posZ, 3); + } + this.setDead(); + explode(); + } + + if (this.arrowShake > 0) + { + --this.arrowShake; + } + else + { + ++this.ticksInAir; + Vec3 vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + Vec3 vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec31, vec3, false, true, false); + vec31 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + vec3 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (movingobjectposition != null) + { + vec3 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + } + + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).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.shootingEntity || this.ticksInAir >= 5)) + { + f1 = 0.3F; + AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1); + MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3); + + if (movingobjectposition1 != null) + { + double d1 = vec31.distanceTo(movingobjectposition1.hitVec); + + if (d1 < d0 || d0 == 0.0D) + { + entity = entity1; + d0 = d1; + } + } + } + } + + if (entity != null) + { + movingobjectposition = new MovingObjectPosition(entity); + } + + if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit; + + if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer)) + { + movingobjectposition = null; + } + } + + float f2; + float f4; + + if (movingobjectposition != null) + { + if (movingobjectposition.entityHit != null) + { + f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + int k = MathHelper.ceiling_double_int(f2 * this.damage); + + if (this.getIsCritical()) + { + k += this.rand.nextInt(k / 2 + 2); + } + + explode(); + } + else + { + this.field_145791_d = movingobjectposition.blockX; + this.field_145792_e = movingobjectposition.blockY; + this.field_145789_f = movingobjectposition.blockZ; + this.field_145790_g = this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f); + this.inData = this.worldObj.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f); + } + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + + float f3 = 0.99F; + f1 = 0.05F; + + if (this.isInWater()) + { + this.setDead(); + explode(); + } + + if (this.isWet()) + { + this.extinguish(); + } + + this.setPosition(this.posX, this.posY, this.posZ); + this.func_145775_I(); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + @Override + public void writeEntityToNBT(NBTTagCompound p_70014_1_) + { + p_70014_1_.setShort("xTile", (short)this.field_145791_d); + p_70014_1_.setShort("yTile", (short)this.field_145792_e); + p_70014_1_.setShort("zTile", (short)this.field_145789_f); + p_70014_1_.setShort("life", (short)this.ticksInGround); + p_70014_1_.setByte("inTile", (byte)Block.getIdFromBlock(this.field_145790_g)); + p_70014_1_.setByte("inData", (byte)this.inData); + p_70014_1_.setByte("shake", (byte)this.arrowShake); + p_70014_1_.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + p_70014_1_.setByte("pickup", (byte)this.canBePickedUp); + p_70014_1_.setDouble("damage", this.damage); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + @Override + public void readEntityFromNBT(NBTTagCompound p_70037_1_) + { + this.field_145791_d = p_70037_1_.getShort("xTile"); + this.field_145792_e = p_70037_1_.getShort("yTile"); + this.field_145789_f = p_70037_1_.getShort("zTile"); + this.ticksInGround = p_70037_1_.getShort("life"); + this.field_145790_g = Block.getBlockById(p_70037_1_.getByte("inTile") & 255); + this.inData = p_70037_1_.getByte("inData") & 255; + this.arrowShake = p_70037_1_.getByte("shake") & 255; + this.inGround = p_70037_1_.getByte("inGround") == 1; + + if (p_70037_1_.hasKey("damage", 99)) + { + this.damage = p_70037_1_.getDouble("damage"); + } + + if (p_70037_1_.hasKey("pickup", 99)) + { + this.canBePickedUp = p_70037_1_.getByte("pickup"); + } + else if (p_70037_1_.hasKey("player", 99)) + { + this.canBePickedUp = p_70037_1_.getBoolean("player") ? 1 : 0; + } + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + @Override + protected boolean canTriggerWalking() + { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public float getShadowSize() + { + return 0.0F; + } + + public void setDamage(double p_70239_1_) + { + this.damage = p_70239_1_; + } + + public double getDamage() + { + return this.damage; + } + + /** + * Sets the amount of knockback the arrow applies when it hits a mob. + */ + public void setKnockbackStrength(int p_70240_1_) + { + this.knockbackStrength = p_70240_1_; + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + @Override + public boolean canAttackWithItem() + { + return false; + } + + /** + * Whether the arrow has a stream of critical hit particles flying behind it. + */ + public void setIsCritical(boolean p_70243_1_) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (p_70243_1_) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2))); + } + } + + /** + * Whether the arrow has a stream of critical hit particles flying behind it. + */ + public boolean getIsCritical() + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + return (b0 & 1) != 0; + } + + private void explode() { + if(!worldObj.isRemote) { + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, + "random.explode", 100.0f, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + + EntityNukeExplosionMK3 entity = new EntityNukeExplosionMK3(this.worldObj); + entity.posX = this.posX; + entity.posY = this.posY; + entity.posZ = this.posZ; + entity.destructionRange = 10; + entity.speed = 25; + entity.coefficient = 1.0F; + entity.waste = false; + + this.worldObj.spawnEntityInWorld(entity); + + EntityCloudFleijaRainbow cloud = new EntityCloudFleijaRainbow(this.worldObj, 10); + cloud.posX = this.posX; + cloud.posY = this.posY; + cloud.posZ = this.posZ; + this.worldObj.spawnEntityInWorld(cloud); + } + } +} diff --git a/com/hbm/explosion/ExplosionNukeGeneric.java b/com/hbm/explosion/ExplosionNukeGeneric.java index 3143b79cf..c2c42eb28 100644 --- a/com/hbm/explosion/ExplosionNukeGeneric.java +++ b/com/hbm/explosion/ExplosionNukeGeneric.java @@ -31,6 +31,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.EntityExplosiveBeam; import com.hbm.entity.projectile.EntityMiniMIRV; import com.hbm.entity.projectile.EntityMiniNuke; import com.hbm.interfaces.IConsumer; @@ -147,7 +148,7 @@ public class ExplosionNukeGeneric { if (d9 < wat && !(entity instanceof EntityOcelot) && !(entity instanceof EntityNukeCloudSmall) && !(entity instanceof EntityMIRV) && !(entity instanceof EntityMiniNuke) && !(entity instanceof EntityMiniMIRV) && !(entity instanceof EntityGrenadeASchrab) - && !(entity instanceof EntityGrenadeNuclear) + && !(entity instanceof EntityGrenadeNuclear) && !(entity instanceof EntityExplosiveBeam) && !(entity instanceof EntityPlayer && Library.checkArmor((EntityPlayer) entity, ModItems.euphemium_helmet, ModItems.euphemium_plate, ModItems.euphemium_legs, ModItems.euphemium_boots))) { diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index 89ad9d7d7..1f5a44c9f 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -42,6 +42,7 @@ public class ModItems { public static Item ingot_uranium; public static Item ingot_u235; public static Item ingot_u238; + public static Item ingot_u238m2; public static Item ingot_plutonium; public static Item ingot_pu238; public static Item ingot_pu239; @@ -688,6 +689,7 @@ public class ModItems { public static Item gun_bolt_action; public static Item gun_bolt_action_green; public static Item gun_bolt_action_ammo; + public static Item gun_b92; public static Item gun_xvl1456; public static Item gun_xvl1456_ammo; public static Item gun_osipr; @@ -1169,6 +1171,7 @@ public class ModItems { ingot_uranium = new ItemRadioactive().setUnlocalizedName("ingot_uranium").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":ingot_uranium"); ingot_u235 = new ItemRadioactive().setUnlocalizedName("ingot_u235").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":ingot_u235"); ingot_u238 = new ItemRadioactive().setUnlocalizedName("ingot_u238").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":ingot_u238"); + ingot_u238m2 = new ItemUnstable(350, 20).setUnlocalizedName("ingot_u238m2").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":ingot_u238m2"); ingot_plutonium = new ItemRadioactive().setUnlocalizedName("ingot_plutonium").setCreativeTab(MainRegistry.tabParts).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":ingot_plutonium"); ingot_pu238 = new ItemRadioactive().setUnlocalizedName("ingot_pu238").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":ingot_pu238"); ingot_pu239 = new ItemRadioactive().setUnlocalizedName("ingot_pu239").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":ingot_pu239"); @@ -1768,6 +1771,7 @@ public class ModItems { gun_lever_action_dark = new GunLeverAction().setUnlocalizedName("gun_lever_action_dark").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_lever_action_dark"); gun_bolt_action_ammo = new Item().setUnlocalizedName("gun_bolt_action_ammo").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_bolt_action_ammo"); gun_bolt_action = new GunBoltAction().setUnlocalizedName("gun_bolt_action").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_bolt_action"); + gun_b92 = new GunB92().setUnlocalizedName("gun_b92").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_b92"); gun_bolt_action_green = new GunBoltAction().setUnlocalizedName("gun_bolt_action_green").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_bolt_action_green"); gun_xvl1456_ammo = new Item().setUnlocalizedName("gun_xvl1456_ammo").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_xvl1456_ammo"); gun_xvl1456 = new GunXVL1456().setUnlocalizedName("gun_xvl1456").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":gun_xvl1456"); @@ -2282,6 +2286,7 @@ public class ModItems { GameRegistry.registerItem(ingot_uranium, ingot_uranium.getUnlocalizedName()); GameRegistry.registerItem(ingot_u235, ingot_u235.getUnlocalizedName()); GameRegistry.registerItem(ingot_u238, ingot_u238.getUnlocalizedName()); + GameRegistry.registerItem(ingot_u238m2, ingot_u238m2.getUnlocalizedName()); GameRegistry.registerItem(ingot_plutonium, ingot_plutonium.getUnlocalizedName()); GameRegistry.registerItem(ingot_pu238, ingot_pu238.getUnlocalizedName()); GameRegistry.registerItem(ingot_pu239, ingot_pu239.getUnlocalizedName()); @@ -2997,6 +3002,7 @@ public class ModItems { GameRegistry.registerItem(gun_lever_action_dark, gun_lever_action_dark.getUnlocalizedName()); GameRegistry.registerItem(gun_bolt_action, gun_bolt_action.getUnlocalizedName()); GameRegistry.registerItem(gun_bolt_action_green, gun_bolt_action_green.getUnlocalizedName()); + GameRegistry.registerItem(gun_b92, gun_b92.getUnlocalizedName()); GameRegistry.registerItem(gun_xvl1456, gun_xvl1456.getUnlocalizedName()); GameRegistry.registerItem(gun_osipr, gun_osipr.getUnlocalizedName()); GameRegistry.registerItem(gun_immolator, gun_immolator.getUnlocalizedName()); diff --git a/com/hbm/items/special/ItemUnstable.java b/com/hbm/items/special/ItemUnstable.java new file mode 100644 index 000000000..ffbec9bd1 --- /dev/null +++ b/com/hbm/items/special/ItemUnstable.java @@ -0,0 +1,46 @@ +package com.hbm.items.special; + +import com.hbm.entity.logic.EntityNukeExplosionMK4; +import com.hbm.lib.ModDamageSource; + +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class ItemUnstable extends Item { + + int radius; + int timer; + + public ItemUnstable(int radius, int timer) { + this.radius = radius; + this.timer = timer; + } + + public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean b) { + this.setTimer(stack, this.getTimer(stack) + 1); + + if(this.getTimer(stack) == timer && !world.isRemote) { + world.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(world, radius, entity.posX, entity.posY, entity.posZ)); + world.playSoundAtEntity(entity, "hbm:weapon.immolatorIgnite", 1.0F, 1.0F); + entity.attackEntityFrom(ModDamageSource.nuclearBlast, 10000); + } + } + + private void setTimer(ItemStack stack, int time) { + if(!stack.hasTagCompound()) + stack.stackTagCompound = new NBTTagCompound(); + + stack.stackTagCompound.setInteger("timer", time); + } + + private int getTimer(ItemStack stack) { + if(!stack.hasTagCompound()) + stack.stackTagCompound = new NBTTagCompound(); + + return stack.stackTagCompound.getInteger("timer"); + } + +} diff --git a/com/hbm/items/weapon/GunB92.java b/com/hbm/items/weapon/GunB92.java new file mode 100644 index 000000000..ce9eba3a5 --- /dev/null +++ b/com/hbm/items/weapon/GunB92.java @@ -0,0 +1,309 @@ +package com.hbm.items.weapon; + +import java.util.List; +import java.util.Random; + +import com.google.common.collect.Multimap; +import com.hbm.entity.effect.EntityCloudFleijaRainbow; +import com.hbm.entity.logic.EntityNukeExplosionMK3; +import com.hbm.entity.projectile.EntityBullet; +import com.hbm.entity.projectile.EntityExplosiveBeam; +import com.hbm.items.ModItems; +import com.hbm.main.MainRegistry; + +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.EnumRarity; +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 GunB92 extends Item { + + Random rand = new Random(); + + public int dmgMin = 16; + public int dmgMax = 28; + + public GunB92() { + + this.maxStackSize = 1; + } + + @Override + public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_) { + if (!p_77615_3_.isSneaking()) { + 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 = true; + + if (flag) { + 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; + } + + if (!p_77615_2_.isRemote) + for(int i = 0; i < getPower(p_77615_1_); i++) { + EntityExplosiveBeam entityarrow1; + entityarrow1 = new EntityExplosiveBeam(p_77615_2_, p_77615_3_, 3.0F); + + float divergence = i * 0.2F; + + if(divergence > 1F) + divergence = 1F; + + if(i > 0) { + entityarrow1.motionX += rand.nextGaussian() * divergence; + entityarrow1.motionY += rand.nextGaussian() * divergence; + entityarrow1.motionZ += rand.nextGaussian() * divergence; + } + + p_77615_1_.damageItem(1, p_77615_3_); + + p_77615_2_.spawnEntityInWorld(entityarrow1); + } + + p_77615_2_.playSoundAtEntity(p_77615_3_, "hbm:weapon.sparkShoot", 5.0F, 1.0F); + + setAnim(p_77615_1_, 1); + setPower(p_77615_1_, 0); + } + } else { + } + } + + @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.b92Reload", 2F, 0.9F); + setPower(stack, getPower(stack) + 1); + + if(getPower(stack) > 10) { + + setPower(stack, 0); + + if(!world.isRemote) { + world.playSoundEffect(entity.posX, entity.posY, entity.posZ, + "random.explode", 100.0f, world.rand.nextFloat() * 0.1F + 0.9F); + + EntityNukeExplosionMK3 exp = new EntityNukeExplosionMK3(world); + exp.posX = entity.posX; + exp.posY = entity.posY; + exp.posZ = entity.posZ; + exp.destructionRange = 50; + exp.speed = 25; + exp.coefficient = 1.0F; + exp.waste = false; + + world.spawnEntityInWorld(exp); + + EntityCloudFleijaRainbow cloud = new EntityCloudFleijaRainbow(world, 50); + cloud.posX = entity.posX; + cloud.posY = entity.posY; + cloud.posZ = entity.posZ; + world.spawnEntityInWorld(cloud); + } + } + } + } + + } + + @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_) { + if (!p_77659_3_.isSneaking() && getPower(p_77659_1_) > 0) { + 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_)); + } else { + if (getAnim(p_77659_1_) == 0) { + setAnim(p_77659_1_, 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(MainRegistry.polaroidID == 11) { + list.add("A weapon that came from the stars."); + list.add("It screams for murder."); + } else if(MainRegistry.polaroidID == 18) { + list.add("One could turn the gun into a bomb"); + list.add("by overloading the capacitors..."); + } else { + list.add("Stay away from me compootur!"); + } + list.add(""); + list.add("Projectiles explode on impact."); + list.add("Sneak while holding the right mouse button"); + list.add("to charge additional energy."); + list.add("The more energy is stored, the less accurate"); + list.add("the beams become."); + list.add("Only up to ten charges may be stored."); + } + + @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); + + } + + private static int getPower(ItemStack stack) { + if (stack.stackTagCompound == null) { + stack.stackTagCompound = new NBTTagCompound(); + return 0; + } + + return stack.stackTagCompound.getInteger("energy"); + + } + + private static void setPower(ItemStack stack, int i) { + if (stack.stackTagCompound == null) { + stack.stackTagCompound = new NBTTagCompound(); + } + + stack.stackTagCompound.setInteger("energy", 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 < 6) + return rad * i; + if (i > 14) + return rad * (5 - (i - 15)); + return rad * 5; + } + + 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); + } + + public static float getTransFromAnim(ItemStack stack) { + float i = getAnim(stack); + + if (i < 10) + return 0; + i -= 10; + + if (i > 4 && i < 10) + return (i - 5) * 0.05F; + + if (i > 9 && i < 15) + return (10 * 0.05F) - ((i - 5) * 0.05F); + + return 0; + } + + @Override + public EnumRarity getRarity(ItemStack p_77613_1_) { + + return EnumRarity.uncommon; + } +} diff --git a/com/hbm/lib/RefStrings.java b/com/hbm/lib/RefStrings.java index 9c63f42c3..f9e59f788 100644 --- a/com/hbm/lib/RefStrings.java +++ b/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (6_24-VT-X04)"; + public static final String VERSION = "1.0.27 BETA (oof)"; //HBM's Beta Naming Convention: //V T (X-Y-Z) //V -> next release version diff --git a/com/hbm/main/ClientProxy.java b/com/hbm/main/ClientProxy.java index 54ffad5b0..957d79d78 100644 --- a/com/hbm/main/ClientProxy.java +++ b/com/hbm/main/ClientProxy.java @@ -176,6 +176,7 @@ public class ClientProxy extends ServerProxy MinecraftForgeClient.registerItemRenderer(ModItems.gun_bolt_action, new ItemRenderGunAnim()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_lever_action_dark, new ItemRenderGunAnim()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_bolt_action_green, new ItemRenderGunAnim()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_b92, new ItemRenderGunAnim()); MinecraftForgeClient.registerItemRenderer(ModItems.multitool_dig, new ItemRenderMultitool()); MinecraftForgeClient.registerItemRenderer(ModItems.multitool_silk, new ItemRenderMultitool()); @@ -204,6 +205,7 @@ public class ClientProxy extends ServerProxy RenderingRegistry.registerEntityRenderingHandler(EntityLaserBeam.class, new RenderBeam2()); RenderingRegistry.registerEntityRenderingHandler(EntityMinerBeam.class, new RenderBeam3()); RenderingRegistry.registerEntityRenderingHandler(EntitySparkBeam.class, new RenderBeam4()); + RenderingRegistry.registerEntityRenderingHandler(EntityExplosiveBeam.class, new RenderBeam5()); RenderingRegistry.registerEntityRenderingHandler(EntityLN2.class, new RenderLN2(ModItems.energy_ball)); RenderingRegistry.registerEntityRenderingHandler(EntityLaser.class, new RenderLaser()); diff --git a/com/hbm/main/MainRegistry.java b/com/hbm/main/MainRegistry.java index ee380675e..925fea253 100644 --- a/com/hbm/main/MainRegistry.java +++ b/com/hbm/main/MainRegistry.java @@ -118,6 +118,7 @@ import com.hbm.entity.projectile.EntityBullet; import com.hbm.entity.projectile.EntityChopperMine; import com.hbm.entity.projectile.EntityCombineBall; import com.hbm.entity.projectile.EntityDischarge; +import com.hbm.entity.projectile.EntityExplosiveBeam; import com.hbm.entity.projectile.EntityFire; import com.hbm.entity.projectile.EntityLN2; import com.hbm.entity.projectile.EntityLaser; @@ -651,6 +652,7 @@ public class MainRegistry EntityRegistry.registerModEntity(EntityGrenadeGascan.class, "entity_grenade_gascan", 88, this, 1000, 1, true); EntityRegistry.registerModEntity(EntityNukeExplosionMK4.class, "entity_nuke_mk4", 89, this, 1000, 1, true); EntityRegistry.registerModEntity(EntityCloudFleijaRainbow.class, "entity_cloud_rainbow", 90, this, 1000, 1, true); + EntityRegistry.registerModEntity(EntityExplosiveBeam.class, "entity_beam_bomb", 91, this, 1000, 1, true); EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00); EntityRegistry.registerGlobalEntityID(EntityHunterChopper.class, "entity_mob_hunter_chopper", EntityRegistry.findGlobalUniqueEntityId(), 0x000020, 0x2D2D72); diff --git a/com/hbm/render/entity/RenderBeam5.java b/com/hbm/render/entity/RenderBeam5.java new file mode 100644 index 000000000..b70bc6c19 --- /dev/null +++ b/com/hbm/render/entity/RenderBeam5.java @@ -0,0 +1,82 @@ +package com.hbm.render.entity; + +import java.util.Random; + +import org.lwjgl.opengl.GL11; + +import com.hbm.lib.RefStrings; + +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class RenderBeam5 extends Render { + + Random rand = new Random(); + + @Override + public void doRender(Entity rocket, double x, double y, double z, float p_76986_8_, float p_76986_9_) { + //float radius = 0.12F; + //float radius = 0.06F; + float radius = 0.175F; + int distance = 2; + Tessellator tessellator = Tessellator.instance; + + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + GL11.glTranslatef((float) x, (float) y, (float) z); + + GL11.glRotatef(rocket.rotationYaw, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-rocket.rotationPitch, 1.0F, 0.0F, 0.0F); + + boolean red = true; + boolean green = false; + boolean blue = false; + + for (float o = 0; o <= radius; o += radius / 8) { + float color = 1f - (o * 8.333f); + if (color < 0) + color = 0; + tessellator.startDrawingQuads(); + tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f); + tessellator.addVertex(0 + o, 0 - o, 0); + tessellator.addVertex(0 + o, 0 + o, 0); + tessellator.addVertex(0 + o, 0 + o, 0 + distance); + tessellator.addVertex(0 + o, 0 - o, 0 + distance); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f); + tessellator.addVertex(0 - o, 0 - o, 0); + tessellator.addVertex(0 + o, 0 - o, 0); + tessellator.addVertex(0 + o, 0 - o, 0 + distance); + tessellator.addVertex(0 - o, 0 - o, 0 + distance); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f); + tessellator.addVertex(0 - o, 0 + o, 0); + tessellator.addVertex(0 - o, 0 - o, 0); + tessellator.addVertex(0 - o, 0 - o, 0 + distance); + tessellator.addVertex(0 - o, 0 + o, 0 + distance); + tessellator.draw(); + tessellator.startDrawingQuads(); + tessellator.setColorRGBA_F(red ? 1 : color, green ? 1 : color, blue ? 1 : color, 1f); + tessellator.addVertex(0 + o, 0 + o, 0); + tessellator.addVertex(0 - o, 0 + o, 0); + tessellator.addVertex(0 - o, 0 + o, 0 + distance); + tessellator.addVertex(0 + o, 0 + o, 0 + distance); + tessellator.draw(); + } + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glPopMatrix(); + } + + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + return new ResourceLocation(RefStrings.MODID + ":textures/models/PlasmaBeam.png"); + } +} diff --git a/com/hbm/render/item/ItemRenderGunAnim.java b/com/hbm/render/item/ItemRenderGunAnim.java index d52407e44..6ed3212de 100644 --- a/com/hbm/render/item/ItemRenderGunAnim.java +++ b/com/hbm/render/item/ItemRenderGunAnim.java @@ -3,9 +3,11 @@ package com.hbm.render.item; import org.lwjgl.opengl.GL11; import com.hbm.items.ModItems; +import com.hbm.items.weapon.GunB92; import com.hbm.items.weapon.GunBoltAction; import com.hbm.items.weapon.GunLeverAction; import com.hbm.lib.RefStrings; +import com.hbm.render.model.ModelB92; import com.hbm.render.model.ModelBoltAction; import com.hbm.render.model.ModelDash; import com.hbm.render.model.ModelDefabricator; @@ -31,10 +33,12 @@ public class ItemRenderGunAnim implements IItemRenderer { protected ModelLeverAction leveraction; protected ModelBoltAction boltaction; + protected ModelB92 b92; public ItemRenderGunAnim() { leveraction = new ModelLeverAction(); boltaction = new ModelBoltAction(); + b92 = new ModelB92(); } @Override @@ -69,6 +73,8 @@ public class ItemRenderGunAnim implements IItemRenderer { Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelLeverActionDark.png")); if(item.getItem() == ModItems.gun_bolt_action_green) Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelBoltActionGreen.png")); + if(item.getItem() == ModItems.gun_b92) + Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelB92Dark.png")); GL11.glRotatef(-135.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.5F, 0.0F, -0.2F); @@ -86,10 +92,18 @@ public class ItemRenderGunAnim implements IItemRenderer { GL11.glTranslatef(GunBoltAction.getOffsetFromAnim(item) * -1.75F, 0.0F, 0.0F); } + if(item.getItem() == ModItems.gun_b92 && GunB92.getRotationFromAnim(item) > 0) { + float off = GunB92.getRotationFromAnim(item) * 2; + GL11.glRotatef(GunB92.getRotationFromAnim(item) * -90, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(off * -0.5F, off * -0.5F, 0.0F); + } + if(item.getItem() == ModItems.gun_lever_action || item.getItem() == ModItems.gun_lever_action_dark) leveraction.renderAnim((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, GunLeverAction.getRotationFromAnim(item)); if(item.getItem() == ModItems.gun_bolt_action || item.getItem() == ModItems.gun_bolt_action_green) boltaction.renderAnim((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, GunBoltAction.getLevRotationFromAnim(item), GunBoltAction.getTransFromAnim(item)); + if(item.getItem() == ModItems.gun_b92) + b92.renderAnim((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, GunB92.getTransFromAnim(item)); GL11.glPopMatrix(); break; @@ -105,6 +119,8 @@ public class ItemRenderGunAnim implements IItemRenderer { Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelLeverActionDark.png")); if(item.getItem() == ModItems.gun_bolt_action_green) Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelBoltActionGreen.png")); + if(item.getItem() == ModItems.gun_b92) + Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelB92Dark.png")); GL11.glRotatef(-200.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(75.0F, 0.0F, 1.0F, 0.0F); @@ -118,6 +134,8 @@ public class ItemRenderGunAnim implements IItemRenderer { leveraction.renderAnim((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, GunLeverAction.getRotationFromAnim(item)); if(item.getItem() == ModItems.gun_bolt_action || item.getItem() == ModItems.gun_bolt_action_green) boltaction.renderAnim((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, GunBoltAction.getLevRotationFromAnim(item), GunBoltAction.getTransFromAnim(item)); + if(item.getItem() == ModItems.gun_b92) + b92.renderAnim((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, GunB92.getTransFromAnim(item)); GL11.glPopMatrix(); default: break; } diff --git a/com/hbm/render/model/ModelB92.java b/com/hbm/render/model/ModelB92.java new file mode 100644 index 000000000..4fae59313 --- /dev/null +++ b/com/hbm/render/model/ModelB92.java @@ -0,0 +1,216 @@ +// Date: 05.02.2018 14:57:42 +// Template version 1.1 +// Java generated by Techne +// Keep in mind that you still need to fill in some blanks +// - ZeuX + +package com.hbm.render.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelB92 extends ModelBase { + // fields + ModelRenderer Muzzle1; + ModelRenderer Barrel1; + ModelRenderer Barrel2; + ModelRenderer Grip; + ModelRenderer Front1; + ModelRenderer Front2; + ModelRenderer Body; + ModelRenderer Top; + ModelRenderer GripBottom; + ModelRenderer Handle; + ModelRenderer HandleBack; + ModelRenderer Frame1; + ModelRenderer Frame2; + ModelRenderer Frame3; + ModelRenderer Trigger; + ModelRenderer BackPlate1; + ModelRenderer Back; + ModelRenderer BackPlate2; + ModelRenderer Pump1; + ModelRenderer Pump2; + ModelRenderer BodyPlate; + + public ModelB92() { + textureWidth = 64; + textureHeight = 64; + + Muzzle1 = new ModelRenderer(this, 22, 36); + Muzzle1.addBox(0F, 0F, 0F, 2, 3, 2); + Muzzle1.setRotationPoint(-24F, 0.5F, -1F); + Muzzle1.setTextureSize(64, 64); + Muzzle1.mirror = true; + setRotation(Muzzle1, 0F, 0F, 0F); + Barrel1 = new ModelRenderer(this, 0, 0); + Barrel1.addBox(0F, 0F, 0F, 24, 2, 3); + Barrel1.setRotationPoint(-24F, 1F, -1.5F); + Barrel1.setTextureSize(64, 64); + Barrel1.mirror = true; + setRotation(Barrel1, 0F, 0F, 0F); + Barrel2 = new ModelRenderer(this, 0, 5); + Barrel2.addBox(0F, 0F, 0F, 22, 1, 2); + Barrel2.setRotationPoint(-22F, 0.5F, -1F); + Barrel2.setTextureSize(64, 64); + Barrel2.mirror = true; + setRotation(Barrel2, 0F, 0F, 0F); + Grip = new ModelRenderer(this, 0, 8); + Grip.addBox(0F, 0F, 0F, 20, 3, 4); + Grip.setRotationPoint(-20F, 3F, -2F); + Grip.setTextureSize(64, 64); + Grip.mirror = true; + setRotation(Grip, 0F, 0F, 0F); + Front1 = new ModelRenderer(this, 10, 36); + Front1.addBox(0F, 0F, 0F, 2, 4, 4); + Front1.setRotationPoint(-22F, 0.5F, -2F); + Front1.setTextureSize(64, 64); + Front1.mirror = true; + setRotation(Front1, 0F, 0F, 0F); + Front2 = new ModelRenderer(this, 0, 36); + Front2.addBox(0F, 0F, 0F, 2, 6, 3); + Front2.setRotationPoint(-22F, 0F, -1.5F); + Front2.setTextureSize(64, 64); + Front2.mirror = true; + setRotation(Front2, 0F, 0F, 0F); + Body = new ModelRenderer(this, 0, 15); + Body.addBox(0F, 0F, 0F, 15, 7, 4); + Body.setRotationPoint(0F, 0.5F, -2F); + Body.setTextureSize(64, 64); + Body.mirror = true; + setRotation(Body, 0F, 0F, 0F); + Top = new ModelRenderer(this, 28, 60); + Top.addBox(0F, 0F, 0F, 15, 1, 3); + Top.setRotationPoint(0F, 0F, -1.5F); + Top.setTextureSize(64, 64); + Top.mirror = true; + setRotation(Top, 0F, 0F, 0F); + GripBottom = new ModelRenderer(this, 24, 43); + GripBottom.addBox(0F, 0F, 0F, 18, 1, 2); + GripBottom.setRotationPoint(-18F, 5.5F, -1F); + GripBottom.setTextureSize(64, 64); + GripBottom.mirror = true; + setRotation(GripBottom, 0F, 0F, 0F); + Handle = new ModelRenderer(this, 0, 45); + Handle.addBox(0F, 0F, 0F, 6, 15, 4); + Handle.setRotationPoint(6F, 7F, -2F); + Handle.setTextureSize(64, 64); + Handle.mirror = true; + setRotation(Handle, 0F, 0F, -0.2268928F); + HandleBack = new ModelRenderer(this, 20, 46); + HandleBack.addBox(5.5F, 0F, 0F, 1, 15, 3); + HandleBack.setRotationPoint(6F, 7F, -1.5F); + HandleBack.setTextureSize(64, 64); + HandleBack.mirror = true; + setRotation(HandleBack, 0F, 0F, -0.2268928F); + Frame1 = new ModelRenderer(this, 28, 57); + Frame1.addBox(0F, 0F, 0F, 7, 1, 2); + Frame1.setRotationPoint(0.5F, 11F, -1F); + Frame1.setTextureSize(64, 64); + Frame1.mirror = true; + setRotation(Frame1, 0F, 0F, 0F); + Frame2 = new ModelRenderer(this, 28, 51); + Frame2.addBox(0F, 0F, 0F, 2, 4, 2); + Frame2.setRotationPoint(-2F, 6.5F, -1F); + Frame2.setTextureSize(64, 64); + Frame2.mirror = true; + setRotation(Frame2, 0F, 0F, 0F); + Frame3 = new ModelRenderer(this, 46, 57); + Frame3.addBox(0F, -1F, 0F, 3, 1, 2); + Frame3.setRotationPoint(-2F, 10.5F, -1F); + Frame3.setTextureSize(64, 64); + Frame3.mirror = true; + setRotation(Frame3, 0F, 0F, 0.5235988F); + Trigger = new ModelRenderer(this, 36, 53); + Trigger.addBox(0F, 0F, 0F, 2, 3, 1); + Trigger.setRotationPoint(4F, 7F, -0.5F); + Trigger.setTextureSize(64, 64); + Trigger.mirror = true; + setRotation(Trigger, 0F, 0F, 0.1919862F); + BackPlate1 = new ModelRenderer(this, 56, 53); + BackPlate1.addBox(-1F, 0F, 0F, 1, 4, 3); + BackPlate1.setRotationPoint(15F, 0F, -1.5F); + BackPlate1.setTextureSize(64, 64); + BackPlate1.mirror = true; + setRotation(BackPlate1, 0F, 0F, -0.5235988F); + Back = new ModelRenderer(this, 42, 49); + Back.addBox(0F, 0F, 0F, 2, 4, 4); + Back.setRotationPoint(15F, 3.5F, -2F); + Back.setTextureSize(64, 64); + Back.mirror = true; + setRotation(Back, 0F, 0F, 0F); + BackPlate2 = new ModelRenderer(this, 48, 5); + BackPlate2.addBox(-2F, 0F, 0F, 2, 4, 4); + BackPlate2.setRotationPoint(15F, 0.5F, -2F); + BackPlate2.setTextureSize(64, 64); + BackPlate2.mirror = true; + setRotation(BackPlate2, 0F, 0F, -0.4886922F); + Pump1 = new ModelRenderer(this, 46, 29); + Pump1.addBox(0F, 0F, 0F, 7, 2, 2); + Pump1.setRotationPoint(10F, 1F, -1F); + Pump1.setTextureSize(64, 64); + Pump1.mirror = true; + setRotation(Pump1, 0F, 0F, 0F); + Pump2 = new ModelRenderer(this, 44, 33); + Pump2.addBox(0F, 0F, 0F, 3, 3, 7); + Pump2.setRotationPoint(17F, 0.5F, -3.5F); + Pump2.setTextureSize(64, 64); + Pump2.mirror = true; + setRotation(Pump2, 0F, 0F, 0F); + BodyPlate = new ModelRenderer(this, 0, 26); + BodyPlate.addBox(0F, 0F, 0F, 14, 5, 5); + BodyPlate.setRotationPoint(1.5F, 2F, -2.5F); + BodyPlate.setTextureSize(64, 64); + BodyPlate.mirror = true; + setRotation(BodyPlate, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + Muzzle1.render(f5); + Barrel1.render(f5); + Barrel2.render(f5); + Grip.render(f5); + Front1.render(f5); + Front2.render(f5); + Body.render(f5); + Top.render(f5); + GripBottom.render(f5); + Handle.render(f5); + HandleBack.render(f5); + Frame1.render(f5); + Frame2.render(f5); + Frame3.render(f5); + Trigger.render(f5); + BackPlate1.render(f5); + Back.render(f5); + BackPlate2.render(f5); + Pump1.render(f5); + Pump2.render(f5); + BodyPlate.render(f5); + } + + public void renderAnim(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, float tran) { + + Pump1.offsetX += tran; + Pump2.offsetX += tran; + + render(entity, f, f1, f2, f3, f4, f5); + + Pump1.offsetX -= tran; + Pump2.offsetX -= tran; + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } + +}