Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.entity.projectile;
- import cpw.mods.fml.common.FMLCommonHandler;
- import cpw.mods.fml.common.network.PacketDispatcher;
- import cpw.mods.fml.common.network.Player;
- import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- import java.io.ByteArrayOutputStream;
- import java.io.DataOutputStream;
- import java.util.ArrayList;
- import java.util.EmptyStackException;
- import java.util.Iterator;
- import java.util.List;
- import com.google.common.io.ByteArrayDataInput;
- import com.google.common.io.ByteArrayDataOutput;
- import quivermod.QuiverMod;
- import quivermod.TileEntityTorch;
- import net.minecraft.block.Block;
- import net.minecraft.block.StepSound;
- import net.minecraft.block.material.Material;
- import net.minecraft.client.multiplayer.WorldClient;
- import net.minecraft.enchantment.EnchantmentThorns;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLiving;
- 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.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.network.packet.Packet;
- import net.minecraft.network.packet.Packet250CustomPayload;
- import net.minecraft.network.packet.Packet60Explosion;
- import net.minecraft.network.packet.Packet70GameEvent;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.AxisAlignedBB;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.EnumMovingObjectType;
- import net.minecraft.util.MathHelper;
- import net.minecraft.util.MovingObjectPosition;
- import net.minecraft.util.Vec3;
- import net.minecraft.world.ChunkCoordIntPair;
- import net.minecraft.world.Explosion;
- import net.minecraft.world.World;
- import net.minecraft.world.WorldServer;
- import net.minecraft.world.chunk.Chunk;
- import net.minecraft.world.chunk.IChunkProvider;
- import net.minecraft.world.gen.ChunkProviderServer;
- import net.minecraftforge.common.ForgeChunkManager;
- import net.minecraftforge.common.ForgeChunkManager.Ticket;
- public class EntityArrow extends Entity implements IProjectile, IEntityAdditionalSpawnData
- {
- private float gravity = -0.05F;
- public float slowmo = 5;
- public float actualTicks = -1;
- public float prevYawForSlowmo = 0;
- public float prevPitchForSlowmo = 0;
- MovingObjectPosition lastHitMOP = null;
- protected int xTile = -1;
- protected int yTile = -1;
- protected int zTile = -1;
- protected int hitSide = -1;
- protected int inTile = 0;
- protected int inData = 0;
- protected boolean inGround = false;
- public AxisAlignedBB headBoundingBox;
- double headWidth = 0.1;
- /** != 0 if the player can pick up the arrow */
- public int canBePickedUp = 0;
- private ItemStack pickupItemStack = new ItemStack(Item.arrow);
- public float arrowLength = 1;
- /** Timer for arrow shake animation and picking up the arrow. */
- public int arrowShake = 0;
- /** The owner of this arrow. */
- public Entity shootingEntity;
- private int shootingEntityID = -1;
- private String shootingPlayerName = null;
- protected int ticksInGround;
- protected int ticksInAir = 0;
- protected double damage = 2.0D;
- /** The amount of knockback an arrow applies when it hits a mob. */
- protected int knockbackStrength;
- public int ticks = 0;
- private int setFireTicks = -1;
- public boolean exploded = false;
- public float explosionSize = 0;
- public boolean explosionBurn = false;
- public int explosionTime = -1;
- public boolean explodeInWater = false;
- public int breakGlass = 0;
- public double breakGlassVel = 0;
- public boolean teleportShooter = false;
- public Ticket chunkLoader = null;
- public boolean placeTorch = false;
- public ArrayList<PotionEffect> effects;
- private int smokeParticlesPerBlock = 4;
- public EntityArrow(World world)
- {
- super(world);
- this.renderDistanceWeight = 10.0D;
- this.setSize(0.5F, 0.5F);
- }
- public EntityArrow(World world, double x, double y, double z)
- {
- super(world);
- this.renderDistanceWeight = 10.0D;
- this.setSize(0.5F, 0.5F);
- this.setPosition(x, y, z);
- this.yOffset = 0.0F;
- }
- public EntityArrow(World world, EntityLiving shooter, EntityLiving target, float speed, float deviation)
- {
- super(world);
- this.renderDistanceWeight = 10.0D;
- this.shootingEntity = shooter;
- if (shooter instanceof EntityPlayer)
- {
- this.canBePickedUp = 1;
- }
- this.posY = shooter.posY + (double)shooter.getEyeHeight() - 0.1;
- double initVecX = target.posX - shooter.posX;
- double initVecY = target.boundingBox.minY + (target.height / 2) - this.posY;
- double initVecZ = target.posZ - shooter.posZ;
- double vecX = initVecX;
- double vecY = initVecY;
- double vecZ = initVecZ;
- double distance = 0;
- double flightTicks = 0;
- double approxSpeed = speed;
- double moveX = target.posX - target.lastTickPosX;
- double moveY = target.posY - target.lastTickPosY;
- double moveZ = target.posZ - target.lastTickPosZ;
- System.out.println("x " + moveX + " y " + moveY + " z " + moveZ);
- int passes = 4;
- for (int i = 0; i <= passes; i++)
- {
- distance = (double)MathHelper.sqrt_double(vecX * vecX + vecY * vecY + vecZ * vecZ);
- flightTicks = distance / approxSpeed;
- if (i < passes)
- {
- if (worldObj.difficultySetting >= 2)
- {
- vecX = initVecX + moveX * flightTicks;
- vecY = initVecY + moveY * flightTicks;
- vecZ = initVecZ + moveZ * flightTicks;
- }
- approxSpeed = speed * Math.pow(0.99, flightTicks);
- }
- }
- double antiGrav = 0.5F * gravity * flightTicks * flightTicks;
- vecY -= antiGrav;
- double horizDistance = (double)MathHelper.sqrt_double(vecX * vecX + vecZ * vecZ);
- if (horizDistance >= 1.0E-7D)
- {
- float yaw = (float)(Math.atan2(vecZ, vecX) * 180.0D / Math.PI) - 90.0F;
- float pitch = (float)(-(Math.atan2(vecY, horizDistance) * 180.0D / Math.PI));
- double offsetX = vecX / horizDistance;
- double offsetY = vecY / horizDistance;
- double offsetZ = vecZ / horizDistance;
- this.setLocationAndAngles(shooter.posX + offsetX, this.posY + offsetY, shooter.posZ + offsetZ, yaw, pitch);
- this.yOffset = 0.0F;
- this.setThrowableHeading(vecX, vecY, vecZ, speed, deviation);
- }
- }
- public EntityArrow(World world, EntityLiving shooter, float speed)
- {
- super(world);
- this.renderDistanceWeight = 10.0D;
- this.shootingEntity = shooter;
- if (shooter instanceof EntityPlayer)
- {
- this.canBePickedUp = 1;
- }
- this.setSize(0.5F, 0.5F);
- this.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotationYaw, shooter.rotationPitch);
- this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F);
- this.posY -= 0.1;
- this.posZ -= (double)(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 = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
- this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
- this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI));
- this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, speed * 1.5F, 1.0F);
- }
- 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.
- */
- public void setThrowableHeading(double vecX, double vecY, double vecZ, float speed, float deviation)
- {
- float distance = MathHelper.sqrt_double(vecX * vecX + vecY * vecY + vecZ * vecZ);
- vecX /= (double)distance;
- vecY /= (double)distance;
- vecZ /= (double)distance;
- vecX += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)deviation;
- vecY += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)deviation;
- vecZ += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)deviation;
- vecX *= (double)speed;
- vecY *= (double)speed;
- vecZ *= (double)speed;
- this.motionX = vecX;
- this.motionY = vecY;
- this.motionZ = vecZ;
- double horizDistance = MathHelper.sqrt_double(vecX * vecX + vecZ * vecZ);
- this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(vecX, vecZ) * 180.0D / Math.PI);
- this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(vecY, (double)horizDistance) * 180.0D / Math.PI);
- this.ticksInGround = 0;
- }
- public static double degreesToRad = Math.PI / 180;
- protected Vec3 getTipCoords(float length)
- {
- float pitch = (float)(rotationPitch * degreesToRad);
- float yaw = (float)((rotationYaw - 90) * degreesToRad);
- float x = (float)posX + (length * (float)Math.cos(pitch) * (float)Math.cos(yaw));
- float y = (float)posY + (length * (float)Math.sin(pitch));
- float z = (float)posZ + (-length * (float)Math.cos(pitch) * (float)Math.sin(yaw));
- return worldObj.getWorldVec3Pool().getVecFromPool(x, y, z);
- }
- protected void setHeadBounds()
- {
- if (headBoundingBox == null)
- headBoundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
- Vec3 headCoords = getTipCoords(0.4F);
- headBoundingBox.setBounds(headCoords.xCoord - headWidth, headCoords.yCoord - headWidth, headCoords.zCoord - headWidth,
- headCoords.xCoord + headWidth, headCoords.yCoord + headWidth, headCoords.zCoord + headWidth);
- }
- protected void setBounds()
- {
- setHeadBounds();
- Vec3 headCoords = getTipCoords(0.15F);
- Vec3 tailCoords = getTipCoords(-0.6F);
- boundingBox.setBounds(headCoords.xCoord, headCoords.yCoord, headCoords.zCoord,
- headCoords.xCoord, headCoords.yCoord, headCoords.zCoord);
- AxisAlignedBB newBoundingBox = boundingBox.addCoord(tailCoords.xCoord - headCoords.xCoord,
- tailCoords.yCoord - headCoords.yCoord,
- tailCoords.zCoord - headCoords.zCoord).expand(0.15, 0.15, 0.15);
- boundingBox.setBB(newBoundingBox);
- }
- public void setPosition(double par1, double par3, double par5)
- {
- super.setPosition(par1, par3, par5);
- setBounds();
- }
- protected void setRotation(float yaw, float pitch)
- {
- super.setRotation(yaw, pitch);
- setBounds();
- }
- @SideOnly(Side.CLIENT)
- /**
- * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
- * posY, posZ, yaw, pitch
- */
- public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)
- {
- this.setPosition(par1, par3, par5);
- this.setRotation(par7, par8);
- }
- @SideOnly(Side.CLIENT)
- /**
- * Sets the velocity to the args. Args: x, y, z
- */
- public void setVelocity(double par1, double par3, double par5)
- {
- this.motionX = par1;
- this.motionY = par3;
- this.motionZ = par5;
- if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
- {
- float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
- this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI);
- this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)var7) * 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;
- }
- }
- public void setPickupItemStack(ItemStack itemStack)
- {
- pickupItemStack = itemStack;
- }
- public void setExplosive(float size)
- {
- explosionSize = size;
- }
- public void setExplosionBurn(boolean burn)
- {
- explosionBurn = burn;
- }
- public void setExplosionTimer(int time)
- {
- explosionTime = time;
- }
- public void setExplodeWhileInWater(boolean explode)
- {
- explodeInWater = true;
- }
- public void setTeleportShooter(boolean teleport)
- {
- teleportShooter = teleport;
- chunkLoader = ForgeChunkManager.requestTicket(QuiverMod.instance, worldObj, ForgeChunkManager.Type.ENTITY);
- if (chunkLoader != null)
- {
- chunkLoader.bindEntity(this);
- chunkLoader.setChunkListDepth(chunkLoader.getMaxChunkListDepth());
- }
- }
- public void setPlaceTorch(boolean place)
- {
- placeTorch = place;
- }
- public void setPotionEffects(ArrayList<PotionEffect> newEffects)
- {
- effects = newEffects;
- }
- private void getShooter()
- {
- if (actualTicks < 5)
- {
- if (shootingEntity == null)
- {
- if (shootingEntityID != -1)
- {
- shootingEntity = worldObj.getEntityByID(shootingEntityID);
- }
- else if (shootingPlayerName != null)
- {
- shootingEntity = worldObj.getPlayerEntityByName(shootingPlayerName);
- }
- }
- /*if (worldObj.isRemote && shootingEntity == null && QuiverMod.proxy.mc != null && QuiverMod.proxy.mc.isSingleplayer())
- {
- shootingEntity = QuiverMod.proxy.mc.thePlayer;
- }*/
- }
- }
- private int[] getPos()
- {
- int[] pos = new int[3];
- if (inGround)
- {
- int x = xTile;
- int y = yTile;
- int z = zTile;
- if (x == 0 && y == 0 && z == 0)
- {
- x = (int)posX;
- y = (int)posY;
- z = (int)posZ;
- }
- if (hitSide == 0)
- y--;
- else if (hitSide == 1)
- y++;
- else if (hitSide == 2)
- z--;
- else if (hitSide == 3)
- z++;
- else if (hitSide == 4)
- x--;
- else if (hitSide == 5)
- x++;
- pos[0] = x;
- pos[1] = y;
- pos[2] = z;
- }
- else
- {
- pos[0] = (int)posX;
- pos[1] = (int)posY;
- pos[2] = (int)posZ;
- }
- return pos;
- }
- private Vec3 getTeleportPos(MovingObjectPosition mop)
- {
- Vec3 out = worldObj.getWorldVec3Pool().getVecFromPool(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
- if (shootingEntity != null)
- {
- if (mop.sideHit == 0)
- {
- out.yCoord -= shootingEntity.height;
- }
- else if (mop.sideHit == 2)
- {
- out.zCoord -= 0.5;
- }
- else if (mop.sideHit == 3)
- {
- out.zCoord += 0.5;
- }
- else if (mop.sideHit == 4)
- {
- out.xCoord -= 0.5;
- }
- else if (mop.sideHit == 5)
- {
- out.xCoord += 0.5;
- }
- }
- return out;
- }
- private boolean tryExplodeNoDeath(double x, double y, double z)
- {
- if (explosionSize > 0 && !exploded)
- {
- int id = worldObj.getBlockId((int)x, (int)y, (int)z);
- if (explodeInWater || (id != Block.waterStill.blockID && id != Block.waterMoving.blockID))
- {
- if (!worldObj.isRemote)
- {
- Explosion explosion = new Explosion(worldObj, this, x, y, z, explosionSize);
- explosion.indirectExploder = shootingEntity;
- explosion.isFlaming = explosionBurn || isBurning();
- explosion.isSmoking = true;
- explosion.doExplosionA();
- explosion.doExplosionB(true);
- Iterator playerIter = worldObj.playerEntities.iterator();
- while (playerIter.hasNext())
- {
- ((EntityPlayerMP)playerIter.next()).playerNetServerHandler.sendPacketToPlayer(new Packet60Explosion(x, y, z, explosionSize, explosion.affectedBlockPositions, null));
- }
- }
- exploded = true;
- return true;
- }
- }
- return false;
- }
- private void explode(double x, double y, double z)
- {
- if (tryExplodeNoDeath(x, y, z))
- setDead();
- }
- private void explode(Vec3 pos)
- {
- explode(pos.xCoord, pos.yCoord, pos.zCoord);
- }
- private void explode(int x, int y, int z)
- {
- explode((double)x, (double)y, (double)z);
- }
- private void teleportParticles()
- {
- if (shootingEntity != null)
- {
- for (int i = 0; i < 40; i++)
- {
- worldObj.spawnParticle("portal", shootingEntity.posX, shootingEntity.posY - 2 + rand.nextDouble() * 2.0, shootingEntity.posZ, rand.nextGaussian(), 0, rand.nextGaussian());
- }
- }
- }
- private boolean teleport(double x, double y, double z)
- {
- if (teleportShooter && shootingEntity != null && shootingEntity instanceof EntityPlayerMP)
- {
- EntityPlayerMP shooter = ((EntityPlayerMP)shootingEntity);
- worldObj.playSoundEffect(shooter.posX, shooter.posY, shooter.posZ, "mob.endermen.portal", 1.0F, 1.0F);
- shooter.setPositionAndUpdate(x, y, z);
- shooter.fallDistance = 0;
- shooter.attackEntityFrom(DamageSource.fall, 5);
- teleportShooter = false;
- return true;
- }
- return false;
- }
- private boolean teleport(Vec3 pos)
- {
- return teleport(pos.xCoord, pos.yCoord, pos.zCoord);
- }
- public static AxisAlignedBB createBoundingBox(Vec3 vec1, Vec3 vec2)
- {
- AxisAlignedBB out = AxisAlignedBB.getAABBPool().getAABB(0, 0, 0, 0, 0, 0);
- if (vec1.xCoord < vec2.xCoord)
- {
- out.minX = vec1.xCoord;
- out.maxX = vec2.xCoord;
- }
- else
- {
- out.minX = vec2.xCoord;
- out.maxX = vec1.xCoord;
- }
- if (vec1.yCoord < vec2.yCoord)
- {
- out.minY = vec1.yCoord;
- out.maxY = vec2.yCoord;
- }
- else
- {
- out.minY = vec2.yCoord;
- out.maxY = vec1.yCoord;
- }
- if (vec1.zCoord < vec2.zCoord)
- {
- out.minZ = vec1.zCoord;
- out.maxZ = vec2.zCoord;
- }
- else
- {
- out.minZ = vec2.zCoord;
- out.maxZ = vec1.zCoord;
- }
- return out;
- }
- private void onGroundImpact(MovingObjectPosition mop)
- {
- Vec3 teleportPos = getTeleportPos(mop);
- if (!worldObj.isRemote && teleport(teleportPos))
- {
- setDead();
- }
- int[] posInt = getPos();
- int intX = posInt[0];
- int intY = posInt[1];
- int intZ = posInt[2];
- int blockID = worldObj.getBlockId(intX, intY, intZ);
- if (inGround && explosionTime < 0)
- {
- explode(mop.hitVec);
- }
- if (placeTorch)
- {
- intY = (int)mop.hitVec.yCoord;
- if (!worldObj.isRemote)
- QuiverMod.entityTorchBlock.tryPlace(worldObj, intX, intY, intZ, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, mop.sideHit);
- placeTorch = false;
- }
- }
- private boolean canAttackEntity(Entity entity)
- {
- if (entity == null ||
- entity instanceof EntityEnderman)
- return false;
- return true;
- }
- /**
- * Called to update the entity's position/logic.
- */
- public synchronized void onUpdate()
- {
- actualTicks++;
- if (slowmo > 0)
- {
- prevRotationYaw = prevYawForSlowmo;
- prevRotationPitch = prevPitchForSlowmo;
- }
- if (slowmo < 1 || actualTicks % slowmo == 0)
- {
- getShooter();
- if (chunkLoader != null)
- {
- Chunk currentChunk;
- ChunkCoordIntPair chunkPos;
- int size = 25;
- int skip = 5;
- for (int x = -size; x <= size; x += skip)
- {
- for (int z = -size; z <= size; z += skip)
- {
- if (x != 0 || z != 0)
- {
- currentChunk = worldObj.getChunkFromBlockCoords((int)(posX + x), (int)(posZ + z));
- chunkPos = currentChunk.getChunkCoordIntPair();
- ForgeChunkManager.forceChunk(chunkLoader, chunkPos);
- }
- }
- }
- currentChunk = worldObj.getChunkFromBlockCoords((int)posX, (int)posZ);
- chunkPos = currentChunk.getChunkCoordIntPair();
- ForgeChunkManager.forceChunk(chunkLoader, chunkPos);
- }
- double thePrevX = prevPosX;
- double thePrevY = prevPosY;
- double thePrevZ = prevPosZ;
- super.onUpdate();
- ticks++;
- EntityPlayer player;
- if (prevRotationPitch == 0 && prevRotationYaw == 0)
- {
- float motion = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
- prevRotationYaw = rotationYaw = (float)(Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
- prevRotationPitch = rotationPitch = (float)(Math.atan2(motionY, (double)motion) * 180.0D / Math.PI);
- }
- int inBlockID = worldObj.getBlockId(xTile, yTile, zTile);
- if (inBlockID > 0)
- {
- Block.blocksList[inBlockID].setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile);
- AxisAlignedBB bounds = Block.blocksList[inBlockID].getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile);
- if (bounds != null && bounds.isVecInside(worldObj.getWorldVec3Pool().getVecFromPool(posX, posY, posZ)))
- {
- inGround = true;
- }
- }
- if (arrowShake > 0)
- {
- --arrowShake;
- }
- float motion1;
- float motion2;
- if (lastHitMOP != null)
- {
- System.out.println(FMLCommonHandler.instance().getEffectiveSide() + " calculations " + lastHitMOP.hitVec.xCoord + ", " + lastHitMOP.hitVec.yCoord + ", " + lastHitMOP.hitVec.zCoord);
- motion1 = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
- if (lastHitMOP.typeOfHit == EnumMovingObjectType.ENTITY)
- {
- int hitDamage = MathHelper.ceiling_double_int((double)motion1 * damage);
- if (getIsCritical())
- {
- hitDamage += rand.nextInt(hitDamage / 2 + 2);
- }
- DamageSource damageSource = null;
- if (shootingEntity == null)
- {
- damageSource = DamageSource.causeArrowDamage(this, this);
- }
- else
- {
- damageSource = DamageSource.causeArrowDamage(this, shootingEntity);
- }
- if (isBurning())
- {
- lastHitMOP.entityHit.setFire(5);
- }
- if (explosionTime < 0 && lastHitMOP.entityHit.attackEntityFrom(damageSource, hitDamage))
- {
- if (lastHitMOP.entityHit instanceof EntityLiving)
- {
- EntityLiving entityLiving = (EntityLiving)lastHitMOP.entityHit;
- if (!worldObj.isRemote)
- {
- entityLiving.setArrowCountInEntity(entityLiving.getArrowCountInEntity() + 1);
- }
- if (knockbackStrength > 0)
- {
- motion2 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
- if (motion2 > 0.0F)
- {
- lastHitMOP.entityHit.addVelocity(motionX * (double)knockbackStrength * 0.6 / (double)motion2, 0.1, motionZ * (double)knockbackStrength * 0.6 / (double)motion2);
- }
- }
- if (shootingEntity != null)
- {
- EnchantmentThorns.func_92096_a(shootingEntity, entityLiving, rand);
- }
- if (shootingEntity != null && lastHitMOP.entityHit != shootingEntity && lastHitMOP.entityHit instanceof EntityPlayer && shootingEntity instanceof EntityPlayerMP)
- {
- ((EntityPlayerMP)shootingEntity).playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(6, 0));
- }
- }
- playSound("random.bowhit", 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F));
- tryExplodeNoDeath(lastHitMOP.hitVec.xCoord, lastHitMOP.hitVec.yCoord, lastHitMOP.hitVec.zCoord);
- if (lastHitMOP.entityHit instanceof EntityLiving && effects != null)
- {
- EntityLiving entityHitLiving = (EntityLiving)lastHitMOP.entityHit;
- for (PotionEffect effect : effects)
- {
- entityHitLiving.addPotionEffect(effect);
- }
- }
- teleport(lastHitMOP.hitVec.xCoord, lastHitMOP.hitVec.yCoord, lastHitMOP.hitVec.zCoord);
- setDead();
- }
- else if (lastHitMOP.entityHit != shootingEntity)
- {
- float diffX = (float)(posX - lastHitMOP.entityHit.posX);
- float diffY = (float)(posY - lastHitMOP.entityHit.posY);
- float diffZ = (float)(posZ - lastHitMOP.entityHit.posZ);
- float distance = MathHelper.sqrt_float(diffX * diffX + diffY * diffY + diffZ * diffZ);
- diffX /= distance;
- diffY /= distance;
- diffZ /= distance;
- distance = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ) / 3;
- motionX += diffX;
- motionY += diffY;
- motionZ += diffZ;
- float newDistance = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
- motionX /= newDistance;
- motionY /= newDistance;
- motionZ /= newDistance;
- motionX *= distance;
- motionY *= distance;
- motionZ *= distance;
- lastHitMOP.entityHit.motionX -= diffX / 5D;
- lastHitMOP.entityHit.motionY -= diffY / 5D;
- lastHitMOP.entityHit.motionZ -= diffZ / 5D;
- }
- }
- else // TILE
- {
- inGround = true;
- xTile = lastHitMOP.blockX;
- yTile = lastHitMOP.blockY;
- zTile = lastHitMOP.blockZ;
- hitSide = lastHitMOP.sideHit;
- inTile = worldObj.getBlockId(xTile, yTile, zTile);
- inData = worldObj.getBlockMetadata(xTile, yTile, zTile);
- setIsCritical(false);
- arrowShake = 7;
- float volume = motion1 / 3;
- /*if (volMult > 1.5F)
- volMult = 1.5F;
- else */if (volume < 0.25F)
- volume = 0.25F;
- playSound("random.bowhit", volume, 1.2F / (rand.nextFloat() * 0.2F + 0.9F));
- playSound(Block.blocksList[inTile].stepSound.getPlaceSound(), volume, 1.2F / (rand.nextFloat() * 0.2F + 0.9F));
- if (inTile != 0)
- {
- Block.blocksList[inTile].onEntityCollidedWithBlock(worldObj, xTile, yTile, zTile, this);
- }
- onGroundImpact(lastHitMOP);
- }
- lastHitMOP = null;
- //motionX *= 0.001;
- //motionY *= 0.001;
- //motionZ *= 0.001;
- }
- float distance = 0;
- if (this.inGround)
- {
- int blockID = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile);
- int metadata = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
- if (blockID == this.inTile && metadata == this.inData)
- {
- ++this.ticksInGround;
- if (this.ticksInGround >= 1200)
- {
- this.setDead();
- }
- }
- else
- {
- inGround = false;
- double vecX = posX - (xTile + 0.5);
- double vecY = posY - (yTile + 0.5);
- double vecZ = posZ - (zTile + 0.5);
- motionX = vecX * 0.2F;
- motionY = vecY * 0.2F;
- motionZ = vecZ * 0.2F;
- ticksInGround = 0;
- ticksInAir = 0;
- }
- }
- else
- {
- ++this.ticksInAir;
- Vec3 fromVec = null;
- Vec3 toVec = null;
- MovingObjectPosition mop = null;
- double motion = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
- while (fromVec == null || mop != null)
- {
- fromVec = worldObj.getWorldVec3Pool().getVecFromPool(posX, posY, posZ);
- toVec = worldObj.getWorldVec3Pool().getVecFromPool(posX + motionX, posY + motionY, posZ + motionZ);
- mop = worldObj.rayTraceBlocks_do_do(fromVec, toVec, false, true);
- if (mop != null)
- {
- int id = worldObj.getBlockId(mop.blockX, mop.blockY, mop.blockZ);
- if (breakGlass > 0 && motion > breakGlassVel && (id == Block.glass.blockID || id == Block.thinGlass.blockID || id == Block.glowStone.blockID))
- {
- worldObj.setBlock(mop.blockX, mop.blockY, mop.blockZ, 0);
- breakGlass--;
- motionX *= 0.25;
- motionY *= 0.25;
- motionZ *= 0.25;
- }
- else
- {
- break;
- }
- }
- }
- fromVec = worldObj.getWorldVec3Pool().getVecFromPool(posX, posY, posZ);
- toVec = worldObj.getWorldVec3Pool().getVecFromPool(posX + motionX, posY + motionY, posZ + motionZ);
- //fromVec = worldObj.getWorldVec3Pool().getVecFromPool(thePrevX, thePrevY, thePrevZ);
- //toVec = worldObj.getWorldVec3Pool().getVecFromPool(posX, posY, posZ);
- if (mop != null)
- {
- toVec = worldObj.getWorldVec3Pool().getVecFromPool(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
- }
- Vec3 diffVec = fromVec.subtract(toVec);
- List entityList = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
- //List entityList = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(diffVec.xCoord, diffVec.yCoord, diffVec.zCoord).expand(1.0D, 1.0D, 1.0D));
- //AxisAlignedBB hitBounds = createBoundingBox(fromVec, toVec).expand(width + 1, width + 1, width + 1);
- //List entityList = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, hitBounds);
- float expand = 0.3F;
- Entity hitEntity = null;
- double entityDist = -1;
- MovingObjectPosition entityIntercept = null;
- for (int i = 0; i < entityList.size(); ++i)
- {
- Entity curEntity = (Entity)entityList.get(i);
- if (curEntity.canBeCollidedWith() && (curEntity != this.shootingEntity || this.ticksInAir >= 5))
- {
- AxisAlignedBB entityBounds = curEntity.boundingBox.expand((double)expand, (double)expand, (double)expand);
- MovingObjectPosition intercept = entityBounds.calculateIntercept(fromVec, toVec);
- if (intercept != null)
- {
- double curDist = fromVec.distanceTo(intercept.hitVec);
- if (entityDist == -1 || curDist < entityDist)
- {
- hitEntity = curEntity;
- entityDist = curDist;
- entityIntercept = intercept;
- }
- }
- }
- }
- if (hitEntity != null)
- {
- mop = new MovingObjectPosition(hitEntity);
- mop.hitVec = worldObj.getWorldVec3Pool().getVecFromPool(entityIntercept.hitVec.xCoord, entityIntercept.hitVec.yCoord, entityIntercept.hitVec.zCoord);
- mop.sideHit = entityIntercept.sideHit;
- }
- if (mop != null && mop.entityHit != null && mop.entityHit instanceof EntityPlayer)
- {
- EntityPlayer entityplayer = (EntityPlayer)mop.entityHit;
- if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).func_96122_a(entityplayer))
- {
- mop = null;
- }
- }
- if (mop != null && hitEntity != null)
- {
- if (getIsCritical())
- {
- double velX = entityIntercept.hitVec.xCoord - hitEntity.posX;
- double velZ = entityIntercept.hitVec.zCoord - hitEntity.posZ;
- double hitDistSqr = velX * velX + velZ * velZ;
- velX /= hitDistSqr;
- velZ /= hitDistSqr;
- for (int i = 0; i < 32; i++)
- {
- worldObj.spawnParticle("crit", (hitEntity.posX + entityIntercept.hitVec.xCoord) / 2, entityIntercept.hitVec.yCoord, (hitEntity.posZ + entityIntercept.hitVec.zCoord) / 2,
- velX + (rand.nextDouble() - 0.5) * 0.5, rand.nextDouble(), velZ + (rand.nextDouble() - 0.5) * 0.5);
- }
- }
- }
- if (mop != null && (mop.typeOfHit == EnumMovingObjectType.ENTITY ? canAttackEntity(mop.entityHit) : true))
- {
- Vec3 hitVec = mop.hitVec;
- if (mop.entityHit != null)
- {
- /*AxisAlignedBB entityBB = mop.entityHit.boundingBox;
- Vec3 newHitVec;
- if (mop.sideHit <= 1)
- {
- System.out.println("y");
- newHitVec = fromVec.getIntermediateWithYValue(toVec, (entityBB.maxY - entityBB.minY) / 2);
- }
- else if (mop.sideHit <= 3)
- {
- System.out.println("z");
- newHitVec = fromVec.getIntermediateWithZValue(toVec, (entityBB.maxZ - entityBB.minZ) / 2);
- }
- else
- {
- System.out.println("x");
- newHitVec = fromVec.getIntermediateWithXValue(toVec, (entityBB.maxX - entityBB.minX) / 2);
- }
- if (newHitVec != null)
- {
- hitVec = newHitVec;
- }*/
- }
- else
- {
- motionX = hitVec.xCoord - posX;
- motionY = hitVec.yCoord - posY;
- motionZ = hitVec.zCoord - posZ;
- /*motionDist = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
- posX -= motionX / motionDist * 0.05000000074505806D;
- posY -= motionY / motionDist * 0.05000000074505806D;
- posZ -= motionZ / motionDist * 0.05000000074505806D;*/
- }
- lastHitMOP = mop;
- System.out.println(FMLCommonHandler.instance().getEffectiveSide() + " pre " + lastHitMOP.hitVec.xCoord + ", " + lastHitMOP.hitVec.yCoord + ", " + lastHitMOP.hitVec.zCoord);
- }
- posX += this.motionX;
- posY += this.motionY;
- posZ += this.motionZ;
- motion1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
- rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
- double posDiffX = posX - prevPosX;
- double posDiffY = posY - prevPosY;
- double posDiffZ = posZ - prevPosZ;
- distance = MathHelper.sqrt_double(posDiffX * posDiffX + posDiffY * posDiffY + posDiffZ * posDiffZ);
- if (this.getIsCritical())
- {
- for (int i = 0; i < distance; ++i)
- {
- worldObj.spawnParticle("crit", posX + motionX * (double)i / distance, posY + motionY * (double)i / distance, posZ + motionZ * (double)i / distance, -motionX, -motionY + 0.2D, -motionZ);
- }
- }
- float targetPitch = (float)(Math.atan2(this.motionY, (double)motion1) * 180.0D / Math.PI);
- float pitchDiff = rotationPitch - targetPitch;
- float maxRotSpeed = 10;
- if (pitchDiff > maxRotSpeed)
- pitchDiff = maxRotSpeed;
- if (pitchDiff < -maxRotSpeed)
- pitchDiff = -maxRotSpeed;
- rotationPitch -= pitchDiff;
- /*for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)motionDist) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
- {
- ;
- }
- while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
- {
- this.prevRotationPitch += 360.0F;
- }
- while (this.rotationYaw - this.prevRotationYaw < -180.0F)
- {
- this.prevRotationYaw -= 360.0F;
- }
- while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
- {
- this.prevRotationYaw += 360.0F;
- }*/
- //this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
- rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
- float slowdown = 0.99F;
- if (this.isInWater())
- {
- for (int var25 = 0; var25 < 4; ++var25)
- {
- motion2 = 0.25F;
- this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)motion2, this.posY - this.motionY * (double)motion2, this.posZ - this.motionZ * (double)motion2, this.motionX, this.motionY, this.motionZ);
- }
- slowdown = 0.8F;
- }
- this.motionX *= (double)slowdown;
- this.motionY *= (double)slowdown;
- this.motionZ *= (double)slowdown;
- this.motionY += (double)gravity;
- this.setPosition(this.posX, this.posY, this.posZ);
- this.doBlockCollisions();
- }
- int[] pos = getPos();
- int x = pos[0];
- int y = pos[1];
- int z = pos[2];
- int blockID = worldObj.getBlockId(x, y, z);
- if ((ticks > explosionTime && explosionTime > 0) || blockID == Block.lavaStill.blockID || blockID == Block.lavaMoving.blockID)
- {
- explode(posX, posY, posZ);
- }
- if (isBurning())
- {
- if (QuiverMod.proxy.mc != null && QuiverMod.proxy.mc.gameSettings.particleSetting <= 1)
- {
- int particles = (int)(smokeParticlesPerBlock * distance);
- if (particles <= 0)
- particles = 1;
- double moveX = posX - prevPosX;
- double moveY = posY - prevPosY;
- double moveZ = posZ - prevPosZ;
- double mult;
- for (int i = 0; i < particles; i++)
- {
- mult = (i / (float)particles); // Multiplier for current position's weight for interpolation
- worldObj.spawnParticle("smoke", posX + (moveX * mult) + ((rand.nextDouble() - 0.5) * 0.25),
- posY + (moveY * mult) + ((rand.nextDouble() - 0.5) * 0.25),
- posZ + (moveZ * mult) + ((rand.nextDouble() - 0.5) * 0.25), 0, 0, 0);
- }
- }
- if (!inGround)
- {
- setFireTicks = -1;
- }
- if (!worldObj.isRemote && inGround && ticksInGround > 25 && setFireTicks == -1)
- {
- boolean replace = false;
- if (worldObj.isAirBlock(x, y, z))
- {
- replace = true;
- }
- else
- {
- Block block = Block.blocksList[worldObj.getBlockId(x, y, z)];
- if (block != null)
- {
- replace = block.blockMaterial.isReplaceable() && !block.blockMaterial.isLiquid();
- }
- }
- if (replace)
- worldObj.setBlock(x, y, z, Block.fire.blockID);
- setFireTicks = ticksInGround;
- }
- if (setFireTicks >= 0 && ticksInGround - setFireTicks > 50)
- {
- setDead();
- }
- }
- if (lastHitMOP != null)
- {
- System.out.println(FMLCommonHandler.instance().getEffectiveSide() + " afterSetPrevMOP " + lastHitMOP.hitVec.xCoord + ", " + lastHitMOP.hitVec.yCoord + ", " + lastHitMOP.hitVec.zCoord);
- }
- }
- if (slowmo > 0)
- {
- prevYawForSlowmo = prevRotationYaw;
- prevPitchForSlowmo = prevRotationPitch;
- }
- if (lastHitMOP != null)
- {
- System.out.println(FMLCommonHandler.instance().getEffectiveSide() + " endrealtick " + lastHitMOP.hitVec.xCoord + ", " + lastHitMOP.hitVec.yCoord + ", " + lastHitMOP.hitVec.zCoord);
- }
- /*}
- else
- {
- this.prevRotationPitch = rotationPitch;
- this.prevRotationYaw = rotationYaw;
- this.rotationPitch += 1;
- this.rotationYaw += 1;
- rotationPitch = rotationPitch % 360;
- rotationYaw = rotationYaw % 360;
- ticks++;
- }*/
- }
- public void setDead()
- {
- if (teleportShooter)
- {
- if (chunkLoader != null)
- {
- Iterator chunkIter = chunkLoader.getChunkList().iterator();
- while (chunkIter.hasNext())
- {
- ChunkCoordIntPair chunk = (ChunkCoordIntPair)chunkIter.next();
- ForgeChunkManager.unforceChunk(chunkLoader, chunk);
- }
- }
- teleportParticles();
- }
- super.setDead();
- }
- public void writeSpawnData(ByteArrayDataOutput data) {
- data.writeInt(ticks);
- data.writeInt(breakGlass);
- data.writeDouble(breakGlassVel);
- data.writeBoolean(exploded);
- data.writeFloat(explosionSize);
- data.writeBoolean(explosionBurn);
- data.writeInt(explosionTime);
- data.writeBoolean(explodeInWater);
- data.writeBoolean(teleportShooter);
- data.writeBoolean(placeTorch);
- if (shootingEntity != null)
- data.writeInt(shootingEntity.entityId);
- else
- data.writeInt(-1);
- }
- public void readSpawnData(ByteArrayDataInput data) {
- ticks = data.readInt();
- breakGlass = data.readInt();
- breakGlassVel = data.readDouble();
- exploded = data.readBoolean();
- explosionSize = data.readFloat();
- explosionBurn = data.readBoolean();
- explosionTime = data.readInt();
- explodeInWater = data.readBoolean();
- teleportShooter = data.readBoolean();
- placeTorch = data.readBoolean();
- shootingEntityID = data.readInt();
- }
- /**
- * (abstract) Protected helper method to write subclass entity data to NBT.
- */
- public void writeEntityToNBT(NBTTagCompound tagCompound)
- {
- tagCompound.setShort("xTile", (short)this.xTile);
- tagCompound.setShort("yTile", (short)this.yTile);
- tagCompound.setShort("zTile", (short)this.zTile);
- tagCompound.setByte("inTile", (byte)this.inTile);
- tagCompound.setByte("inData", (byte)this.inData);
- tagCompound.setByte("shake", (byte)this.arrowShake);
- tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
- tagCompound.setByte("pickup", (byte)this.canBePickedUp);
- tagCompound.setCompoundTag("pickupItemStack", pickupItemStack.writeToNBT(new NBTTagCompound()));
- tagCompound.setDouble("damage", this.damage);
- tagCompound.setInteger("ticks", ticks);
- tagCompound.setInteger("ticksInAir", ticksInAir);
- tagCompound.setInteger("ticksInGround", ticksInGround);
- tagCompound.setInteger("setFireTicks", setFireTicks);
- tagCompound.setBoolean("exploded", exploded);
- tagCompound.setFloat("explosionSize", explosionSize);
- tagCompound.setInteger("explosionTime", explosionTime);
- tagCompound.setBoolean("explodeInWater", explodeInWater);
- tagCompound.setBoolean("teleportShooter", teleportShooter);
- if (shootingEntity != null && shootingEntity instanceof EntityPlayer)
- {
- String entName = ((EntityPlayer)shootingEntity).getEntityName();
- tagCompound.setString("shootingEntityName", entName);
- }
- }
- /**
- * (abstract) Protected helper method to read subclass entity data from NBT.
- */
- public void readEntityFromNBT(NBTTagCompound tagCompound)
- {
- this.xTile = tagCompound.getShort("xTile");
- this.yTile = tagCompound.getShort("yTile");
- this.zTile = tagCompound.getShort("zTile");
- this.inTile = tagCompound.getByte("inTile") & 255;
- this.inData = tagCompound.getByte("inData") & 255;
- this.arrowShake = tagCompound.getByte("shake") & 255;
- this.inGround = tagCompound.getByte("inGround") == 1;
- if (tagCompound.hasKey("damage"))
- {
- this.damage = tagCompound.getDouble("damage");
- }
- if (tagCompound.hasKey("pickup"))
- {
- this.canBePickedUp = tagCompound.getByte("pickup");
- }
- else if (tagCompound.hasKey("player"))
- {
- this.canBePickedUp = tagCompound.getBoolean("player") ? 1 : 0;
- }
- pickupItemStack = ItemStack.loadItemStackFromNBT(tagCompound.getCompoundTag("pickupItemStack"));
- ticks = tagCompound.getInteger("ticks");
- ticksInAir = tagCompound.getInteger("ticksInAir");
- ticksInGround = tagCompound.getInteger("ticksInGround");
- setFireTicks = tagCompound.getInteger("setFireTicks");
- exploded = tagCompound.getBoolean("exploded");
- explosionSize = tagCompound.getFloat("explosionSize");
- explosionTime = tagCompound.getInteger("explosionTime");
- explodeInWater = tagCompound.getBoolean("explodeInWater");
- teleportShooter = tagCompound.getBoolean("teleportShooter");
- if (tagCompound.hasKey("shootingEntityName"))
- {
- String entName = tagCompound.getString("shootingEntityName");
- shootingPlayerName = entName;
- System.out.println("Loaded shooting entity ID " + shootingPlayerName);
- }
- else
- {
- System.out.println("Loaded arrow with no shooting entity");
- }
- }
- /**
- * Called by a player entity when they collide with an entity
- */
- public void onCollideWithPlayer(EntityPlayer player)
- {
- if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)
- {
- boolean var2 = this.canBePickedUp == 1 || this.canBePickedUp == 2;
- if (this.canBePickedUp == 1 && !player.inventory.addItemStackToInventory(pickupItemStack))
- {
- var2 = false;
- }
- if (var2)
- {
- this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
- player.onItemPickup(this, 1);
- this.setDead();
- }
- }
- }
- /**
- * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
- * prevent them from trampling crops
- */
- protected boolean canTriggerWalking()
- {
- return false;
- }
- @SideOnly(Side.CLIENT)
- public float getShadowSize()
- {
- return 0.0F;
- }
- public void setDamage(double par1)
- {
- this.damage = par1;
- }
- public double getDamage()
- {
- return this.damage;
- }
- /**
- * Sets the amount of knockback the arrow applies when it hits a mob.
- */
- public void setKnockbackStrength(int par1)
- {
- this.knockbackStrength = par1;
- }
- /**
- * If returns false, the item will not inflict any damage against entities.
- */
- public boolean canAttackWithItem()
- {
- return false;
- }
- /**
- * Whether the arrow has a stream of critical hit particles flying behind it.
- */
- public void setIsCritical(boolean par1)
- {
- byte var2 = this.dataWatcher.getWatchableObjectByte(16);
- if (par1)
- {
- this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 1)));
- }
- else
- {
- this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -2)));
- }
- }
- /**
- * Whether the arrow has a stream of critical hit particles flying behind it.
- */
- public boolean getIsCritical()
- {
- byte var1 = this.dataWatcher.getWatchableObjectByte(16);
- return (var1 & 1) != 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment