/* * Decompiled with CFR 0.152. * * Could not load the following classes: * cpw.mods.fml.common.registry.IThrowableEntity * cpw.mods.fml.relauncher.Side * cpw.mods.fml.relauncher.SideOnly * mods.flammpfeil.slashblade.ItemSlashBlade * mods.flammpfeil.slashblade.ability.StylishRankManager * mods.flammpfeil.slashblade.ability.StylishRankManager$AttackTypes * net.minecraft.block.Block * net.minecraft.block.material.Material * net.minecraft.entity.Entity * net.minecraft.entity.EntityLivingBase * net.minecraft.entity.player.EntityPlayer * net.minecraft.entity.projectile.EntityArrow * net.minecraft.entity.projectile.EntityFireball * net.minecraft.entity.projectile.EntityThrowable * net.minecraft.item.ItemStack * net.minecraft.nbt.NBTTagCompound * net.minecraft.util.AxisAlignedBB * net.minecraft.util.DamageSource * net.minecraft.util.EntityDamageSource * net.minecraft.util.MathHelper * net.minecraft.world.IBlockAccess * net.minecraft.world.World */ package com.moe.allweapon.Entityadd; import cpw.mods.fml.common.registry.IThrowableEntity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Random; import java.util.Set; import mods.flammpfeil.slashblade.ItemSlashBlade; import mods.flammpfeil.slashblade.ability.StylishRankManager; 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.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntityFireball; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.EntityDamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class EntityDriveAdd extends Entity implements IThrowableEntity { protected Entity thrower; protected ItemStack blade = null; protected Set alreadyHitEntity = new HashSet(); protected float AttackLevel = 0.0f; private int i; private Long startTime = new Date().getTime(); public EntityDriveAdd(World par1World) { super(par1World); } public EntityDriveAdd(World par1World, EntityLivingBase entityLiving, float AttackLevel, boolean multiHit, float roll) { this(par1World, entityLiving, AttackLevel, multiHit); this.setRoll(roll); } public EntityDriveAdd(World par1World, EntityLivingBase entityLiving, float AttackLevel, boolean multiHit) { this(par1World, entityLiving, AttackLevel); this.setIsMultiHit(multiHit); } public EntityDriveAdd(World par1World, EntityLivingBase entityLiving, float AttackLevel) { this(par1World); this.AttackLevel = AttackLevel; this.width = entityLiving.getEyeHeight() / 2.0f; this.thrower = entityLiving; if (this.blade != null && !(this.blade.getItem() instanceof ItemSlashBlade)) { this.blade = null; } this.alreadyHitEntity.clear(); this.alreadyHitEntity.add(this.thrower); this.alreadyHitEntity.add(this.thrower.riddenByEntity); this.alreadyHitEntity.add(this.thrower.ridingEntity); this.ticksExisted = 0; this.setSize(2.0f, 4.0f); this.setLocationAndAngles(this.thrower.posX, this.thrower.posY + (double)this.thrower.getEyeHeight() / 2.0, this.thrower.posZ, this.thrower.rotationYaw, this.thrower.rotationPitch); this.setDriveVector(0.75f); this.setPosition(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); } protected void entityInit() { this.dataWatcher.addObject(4, (Object)0); this.dataWatcher.addObject(5, (Object)Float.valueOf(0.0f)); this.dataWatcher.addObject(10, (Object)0x3333FF); this.dataWatcher.addObject(11, (Object)Float.valueOf(1.0f)); this.dataWatcher.addObject(12, (Object)Float.valueOf(0.25f)); this.dataWatcher.addObject(13, (Object)Float.valueOf(1.0f)); this.dataWatcher.addObject(6, (Object)20); this.dataWatcher.addObject(21, (Object)Float.valueOf(1.05f)); this.dataWatcher.addObject(22, (Object)Float.valueOf(0.0f)); this.dataWatcher.addObject(23, (Object)0); this.dataWatcher.addObject(24, (Object)String.valueOf("")); this.dataWatcher.addObject(25, (Object)String.valueOf("")); this.dataWatcher.addObject(7, (Object)0); this.dataWatcher.addObject(26, (Object)1); } public boolean getIsPlayerSound() { return this.dataWatcher.getWatchableObjectInt(26) == 0; } public void setIsPlayerSound(boolean isPlaySound) { this.dataWatcher.updateObject(26, (Object)((byte)(!isPlaySound ? 1 : 0))); } public float getInitSpeed() { return this.dataWatcher.getWatchableObjectFloat(21); } public void setInitSpeed(float value) { this.dataWatcher.updateObject(21, (Object)Float.valueOf(value)); } public float getNextSpeed() { return this.dataWatcher.getWatchableObjectFloat(22); } public void setNextSpeed(float value) { this.dataWatcher.updateObject(22, (Object)Float.valueOf(value)); } public int getChangeTime() { return this.dataWatcher.getWatchableObjectInt(23); } public void setChangeTime(int value) { this.dataWatcher.updateObject(23, (Object)value); } public String getSound() { return this.dataWatcher.getWatchableObjectString(24); } public void setSound(String value) { this.dataWatcher.updateObject(24, (Object)String.valueOf(value)); } public String getParticle() { return this.dataWatcher.getWatchableObjectString(25); } public void setParticle(String value) { this.dataWatcher.updateObject(25, (Object)String.valueOf(value)); } public float getc() { return this.dataWatcher.getWatchableObjectFloat(11); } public void setc(Float value) { this.dataWatcher.updateObject(11, (Object)Float.valueOf(value.floatValue())); } public float getk() { return this.dataWatcher.getWatchableObjectFloat(12); } public void setk(Float value) { this.dataWatcher.updateObject(12, (Object)Float.valueOf(value.floatValue())); } public float getg() { return this.dataWatcher.getWatchableObjectFloat(13); } public void setg(Float value) { this.dataWatcher.updateObject(13, (Object)Float.valueOf(value.floatValue())); } public int getColor() { return this.dataWatcher.getWatchableObjectInt(10); } public void setColor(int value) { this.dataWatcher.updateObject(10, (Object)value); } public boolean getIsMultiHit() { return this.dataWatcher.getWatchableObjectInt(4) == 0; } public void setIsMultiHit(boolean isMultiHit) { this.dataWatcher.updateObject(4, (Object)((byte)(isMultiHit ? 1 : 0))); } public float getRoll() { return this.dataWatcher.getWatchableObjectFloat(5); } public void setRoll(float roll) { this.dataWatcher.updateObject(5, (Object)Float.valueOf(roll)); } public int getLifeTime() { return this.dataWatcher.getWatchableObjectInt(6); } public void setLifeTime(int lifetime) { this.dataWatcher.updateObject(6, (Object)lifetime); } public boolean getIsSlashDimension() { return this.dataWatcher.getWatchableObjectInt(7) == 1; } public void setIsSlashDimension(boolean isSlashDimension) { this.dataWatcher.updateObject(7, (Object)((byte)(isSlashDimension ? 1 : 0))); } public void setInitialSpeed(float f) { this.setLocationAndAngles(this.thrower.posX, this.thrower.posY + (double)this.thrower.getEyeHeight() / 2.0, this.thrower.posZ, this.thrower.rotationYaw, this.thrower.rotationPitch); this.setDriveVector(f); } public void setDriveVector(float fYVecOfst) { float fYawDtoR = this.rotationYaw / 180.0f * 3.141593f; float fPitDtoR = this.rotationPitch / 180.0f * 3.141593f; this.motionX = -MathHelper.sin((float)fYawDtoR) * MathHelper.cos((float)fPitDtoR) * fYVecOfst; this.motionY = -MathHelper.sin((float)fPitDtoR) * fYVecOfst; this.motionZ = MathHelper.cos((float)fYawDtoR) * MathHelper.cos((float)fPitDtoR) * fYVecOfst; float f3 = MathHelper.sqrt_double((double)(this.motionX * this.motionX + this.motionZ * this.motionZ)); this.prevRotationPitch = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0 / Math.PI); this.prevRotationYaw = this.rotationPitch = (float)(Math.atan2(this.motionY, f3) * 180.0 / Math.PI); } public void onUpdate() { long time = new Date().getTime(); long time_2 = (time - this.startTime) / 1000L; if (time_2 >= 3L) { this.alreadyHitEntity.clear(); this.alreadyHitEntity = null; this.setDead(); return; } if (!this.worldObj.isRemote) { int nPosZ; int nPosY; int nPosX; Block nBlock; double dAmbit = 1.5; AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(this.posX - dAmbit, this.posY - dAmbit, this.posZ - dAmbit, this.posX + dAmbit, this.posY + dAmbit, this.posZ + dAmbit); if (this.getThrower() instanceof EntityLivingBase) { EntityLivingBase entityLiving = (EntityLivingBase)this.getThrower(); List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.getThrower(), bb, ItemSlashBlade.DestructableSelector); StylishRankManager.setNextAttackType((Entity)this.thrower, (String)StylishRankManager.AttackTypes.DestructObject); list.removeAll(this.alreadyHitEntity); this.alreadyHitEntity.addAll(list); for (Entity curEntity : (java.util.List)(java.util.List)list) { boolean isDestruction = true; if (curEntity instanceof EntityFireball) { isDestruction = ((EntityFireball)curEntity).shootingEntity != null && ((EntityFireball)curEntity).shootingEntity.getEntityId() == entityLiving.getEntityId() ? false : !curEntity.attackEntityFrom(DamageSource.causeMobDamage(entityLiving), this.AttackLevel / 5.0f); } else if (curEntity instanceof EntityArrow) { if (((EntityArrow)curEntity).shootingEntity != null && ((EntityArrow)curEntity).shootingEntity.getEntityId() == entityLiving.getEntityId()) { isDestruction = false; } } else if (curEntity instanceof IThrowableEntity) { if (((IThrowableEntity)curEntity).getThrower() != null && ((IThrowableEntity)curEntity).getThrower().getEntityId() == entityLiving.getEntityId()) { isDestruction = false; } } else if (curEntity instanceof EntityThrowable && ((EntityThrowable)curEntity).getThrower() != null && ((EntityThrowable)curEntity).getThrower().getEntityId() == entityLiving.getEntityId()) { isDestruction = false; } if (!isDestruction) continue; curEntity.motionX = 0.0; curEntity.motionY = 0.0; curEntity.motionZ = 0.0; curEntity.setDead(); for (int var1 = 0; var1 < 10; ++var1) { Random rand = this.getRand(); double var2 = rand.nextGaussian() * 0.02; double var4 = rand.nextGaussian() * 0.02; double var6 = rand.nextGaussian() * 0.02; double var8 = 10.0; this.worldObj.spawnParticle("explode", curEntity.posX + (double)(rand.nextFloat() * curEntity.width * 2.0f) - (double)curEntity.width - var2 * var8, curEntity.posY + (double)(rand.nextFloat() * curEntity.height) - var4 * var8, curEntity.posZ + (double)(rand.nextFloat() * curEntity.width * 2.0f) - (double)curEntity.width - var6 * var8, var2, var4, var6); } StylishRankManager.doAttack((Entity)this.thrower); } } if (!this.getIsMultiHit() || this.ticksExisted % 2 == 0) { List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.getThrower(), bb, ItemSlashBlade.AttackableSelector); list.removeAll(this.alreadyHitEntity); if (!this.getIsMultiHit()) { this.alreadyHitEntity.addAll(list); } float magicDamage = Math.max(1.0f, this.AttackLevel); if (this.getIsMultiHit()) { StylishRankManager.setNextAttackType((Entity)this.thrower, (String)StylishRankManager.AttackTypes.QuickDrive); } else { StylishRankManager.setNextAttackType((Entity)this.thrower, (String)StylishRankManager.AttackTypes.Drive); } for (Entity curEntity : (java.util.List)(java.util.List)list) { float health; if (this.getIsSlashDimension() && curEntity instanceof EntityLivingBase && 0.0f < (health = ((EntityLivingBase)curEntity).getHealth())) { health = Math.max(1.0f, health - magicDamage); ((EntityLivingBase)curEntity).setHealth(health); } curEntity.hurtResistantTime = 0; DamageSource ds = new EntityDamageSource("directMagic", this.getThrower()).setMagicDamage().setProjectile(); curEntity.attackEntityFrom(ds, magicDamage / 5.0f); if (this.blade == null || !(curEntity instanceof EntityLivingBase)) continue; ((ItemSlashBlade)this.blade.getItem()).hitEntity(this.blade, (EntityLivingBase)curEntity, (EntityLivingBase)this.thrower); } } if ((nBlock = this.worldObj.getBlock(nPosX = MathHelper.floor_double((double)this.posX), nPosY = MathHelper.floor_double((double)this.posY), nPosZ = MathHelper.floor_double((double)this.posZ))).getCollisionBoundingBoxFromPool(this.worldObj, nPosX, nPosY, nPosZ) != null && !nBlock.isAir(this.worldObj, nPosX, nPosY, nPosZ)) { this.setDead(); } } this.motionX *= 1.049999952316284; this.motionY *= 1.049999952316284; this.motionZ *= 1.049999952316284; double m_x = this.motionX; double m_y = this.motionY; double m_z = this.motionZ; this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; this.setPosition(this.posX, this.posY, this.posZ); int changeTime = this.getChangeTime(); if (changeTime != 0 && this.ticksExisted >= changeTime) { float nextSpeed = this.getNextSpeed(); this.playSound(); this.motionX = m_x *= (double)nextSpeed; this.motionY = m_y *= (double)nextSpeed; this.motionZ = m_z *= (double)nextSpeed; this.posX += m_x; this.posY += m_y; this.posZ += m_z; } else { float initSpeed = this.getInitSpeed(); if (initSpeed >= 1.05f) { this.motionX = m_x *= (double)initSpeed; this.motionY = m_y *= (double)initSpeed; this.motionZ = m_z *= (double)initSpeed; this.posX += m_x; this.posY += m_y; this.posZ += m_z; } else { this.posX += this.motionX * 0.1; this.posY += this.motionY * 0.1; this.posZ += this.motionZ * 0.1; } } this.playParticle(); this.setPosition(this.posX, this.posY, this.posZ); if (this.ticksExisted >= this.getLifeTime()) { this.alreadyHitEntity.clear(); this.alreadyHitEntity = null; this.setDead(); } } public Random getRand() { return this.rand; } public boolean canBePushed(double par1, double par3, double par5) { return false; } public void moveEntity(double par1, double par3, double par5) { } protected void fall(int par1) { } public boolean isInWater() { return false; } public boolean isInsideOfMaterial(Material par1Material) { return false; } public boolean handleWaterMovement() { return false; } @SideOnly(value=Side.CLIENT) public int getBrightnessForRender(float par1) { float f1 = 0.5f; if (f1 < 0.0f) { f1 = 0.0f; } if (f1 > 1.0f) { f1 = 1.0f; } int i = super.getBrightnessForRender(par1); int j = i & 0xFF; int k = i >> 16 & 0xFF; if ((j += (int)(f1 * 15.0f * 16.0f)) > 240) { j = 240; } return j | k << 16; } public float getBrightness(float par1) { float f1 = super.getBrightness(par1); float f2 = 0.9f; f2 = f2 * f2 * f2 * f2; return f1 * (1.0f - f2) + f2; } protected void readEntityFromNBT(NBTTagCompound nbttagcompound) { } protected void writeEntityToNBT(NBTTagCompound nbttagcompound) { } @SideOnly(value=Side.CLIENT) public float getShadowSize() { return 0.0f; } public void setInWeb(Entity par1Entity) { } @SideOnly(value=Side.CLIENT) public void setVelocity(double par1, double par3, double par5, float par7, float par8, int par9) { } public void onKillEntity() { } public boolean isInRangeToRenderDist() { return false; } public boolean shouldRenderInPass(int pass) { return pass == 1; } public void playLivingSound() { } public Entity getThrower() { return this.thrower; } public void setThrower(Entity entity) { this.thrower = entity; } public void playParticle() { this.i = 0; while (this.i < 20) { String particle = this.getParticle(); if (particle != null && !particle.equals("")) { Random rand = new Random(); double var2 = rand.nextGaussian() * 0.12; double var4 = rand.nextGaussian() * 0.12; double var6 = rand.nextGaussian() * 0.12; double var8 = 10.0; this.worldObj.spawnParticle(particle, this.posX + (double)(rand.nextFloat() * this.width * 2.0f) - (double)this.width - var2 * var8, this.posY + (double)(rand.nextFloat() * this.height) - var4 * var8, this.posZ + (double)(rand.nextFloat() * this.width * 2.0f) - (double)this.width - var6 * var8, var2, var4, var6); } ++this.i; } } public void playSound() { if (!this.getIsPlayerSound()) { String sound = this.getSound(); if (sound != null && !sound.equals("") && this.thrower instanceof EntityPlayer) { this.thrower.playSound(sound, 1.0f, 1.5f); } this.setIsPlayerSound(true); } } }