diff --git a/src/main/java/net/minecraft/entity/EntityLivingBase.java b/src/main/java/net/minecraft/entity/EntityLivingBase.java index 8d33879..6b2cbf3 100644 --- a/src/main/java/net/minecraft/entity/EntityLivingBase.java +++ b/src/main/java/net/minecraft/entity/EntityLivingBase.java @@ -54,22 +54,31 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.client.entity.EntityPlayerSP; -/**+ +/** + * + * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * * Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!" * Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team * - * EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved. + * EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights + * Reserved. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * @@ -82,7 +91,8 @@ public abstract class EntityLivingBase extends Entity { private BaseAttributeMap attributeMap; private final CombatTracker _combatTracker = new CombatTracker(this); private final Map activePotionsMap = Maps.newHashMap(); - /**+ + /** + * + * The equipment this mob was previously wearing, used for * syncing. */ @@ -108,7 +118,8 @@ public abstract class EntityLivingBase extends Entity { public float prevRenderYawOffset; public float rotationYawHead; public float prevRotationYawHead; - /**+ + /** + * + * A factor used to determine how far this entity will move each * tick if it is jumping or falling. */ @@ -134,7 +145,8 @@ public abstract class EntityLivingBase extends Entity { protected double newPosZ; protected double newRotationYaw; protected double newRotationPitch; - /**+ + /** + * + * Whether the DataWatcher needs to be updated with the active * potions */ @@ -147,7 +159,8 @@ public abstract class EntityLivingBase extends Entity { private int jumpTicks; private float absorptionAmount; - /**+ + /** + * + * Called by the /kill command. */ public void onKillCommand() { @@ -209,7 +222,8 @@ public abstract class EntityLivingBase extends Entity { return false; } - /**+ + /** + * + * Gets called every tick from main Entity class */ public void onEntityUpdate() { @@ -307,14 +321,16 @@ public abstract class EntityLivingBase extends Entity { this.worldObj.theProfiler.endSection(); } - /**+ + /** + * + * If Animal, checks if the age timer is negative */ public boolean isChild() { return false; } - /**+ + /** + * + * handles entity death timer, experience orb and particle * creation */ @@ -349,7 +365,8 @@ public abstract class EntityLivingBase extends Entity { } - /**+ + /** + * + * Entity won't drop items or experience points if this returns * false */ @@ -357,7 +374,8 @@ public abstract class EntityLivingBase extends Entity { return !this.isChild(); } - /**+ + /** + * + * Decrements the entity's air supply when underwater */ protected int decreaseAirSupply(int parInt1) { @@ -365,14 +383,16 @@ public abstract class EntityLivingBase extends Entity { return i > 0 && this.rand.nextInt(i + 1) > 0 ? parInt1 : parInt1 - 1; } - /**+ + /** + * + * Get the experience points the entity currently has. */ protected int getExperiencePoints(EntityPlayer player) { return 0; } - /**+ + /** + * + * Only use is to identify if class is an instance of player for * experience dropping */ @@ -419,7 +439,8 @@ public abstract class EntityLivingBase extends Entity { return this.entityAge; } - /**+ + /** + * + * (abstract) Protected helper method to write subclass entity * data to NBT. */ @@ -460,7 +481,8 @@ public abstract class EntityLivingBase extends Entity { } - /**+ + /** + * + * (abstract) Protected helper method to read subclass entity * data from NBT. */ @@ -551,7 +573,8 @@ public abstract class EntityLivingBase extends Entity { } - /**+ + /** + * + * Clears potion metadata values if the entity has no potion * effects. Otherwise, updates potion effect color, ambience, * and invisibility metadata values @@ -570,7 +593,8 @@ public abstract class EntityLivingBase extends Entity { } - /**+ + /** + * + * Resets the potion effect color and ambience metadata values */ protected void resetPotionEffectMetadata() { @@ -604,7 +628,8 @@ public abstract class EntityLivingBase extends Entity { return this.activePotionsMap.containsKey(Integer.valueOf(potionIn.id)); } - /**+ + /** + * + * returns the PotionEffect for the supplied Potion if it is * active, null otherwise. */ @@ -612,7 +637,8 @@ public abstract class EntityLivingBase extends Entity { return (PotionEffect) this.activePotionsMap.get(Integer.valueOf(potionIn.id)); } - /**+ + /** + * + * adds a PotionEffect to the entity */ public void addPotionEffect(PotionEffect potioneffectIn) { @@ -641,21 +667,24 @@ public abstract class EntityLivingBase extends Entity { return true; } - /**+ + /** + * + * Returns true if this entity is undead. */ public boolean isEntityUndead() { return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; } - /**+ + /** + * + * Remove the speified potion effect from this entity. */ public void removePotionEffectClient(int potionId) { this.activePotionsMap.remove(Integer.valueOf(potionId)); } - /**+ + /** + * + * Remove the specified potion effect from this entity. */ public void removePotionEffect(int potionId) { @@ -695,7 +724,8 @@ public abstract class EntityLivingBase extends Entity { } - /**+ + /** + * + * Heal living entity (param: amount of half-hearts) */ public void heal(float f) { @@ -714,7 +744,8 @@ public abstract class EntityLivingBase extends Entity { this.dataWatcher.updateObject(6, Float.valueOf(MathHelper.clamp_float(health, 0.0F, this.getMaxHealth()))); } - /**+ + /** + * + * Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource damagesource, float f) { @@ -813,7 +844,8 @@ public abstract class EntityLivingBase extends Entity { } } - /**+ + /** + * + * Renders broken item particles using the given ItemStack */ public void renderBrokenItemStack(ItemStack stack) { @@ -834,7 +866,8 @@ public abstract class EntityLivingBase extends Entity { } - /**+ + /** + * + * Called when the mob's health reaches 0. */ public void onDeath(DamageSource damagesource) { @@ -868,13 +901,15 @@ public abstract class EntityLivingBase extends Entity { this.worldObj.setEntityState(this, (byte) 3); } - /**+ + /** + * + * Drop the equipment for this entity. */ protected void dropEquipment(boolean parFlag, int parInt1) { } - /**+ + /** + * + * knocks back this entity */ public void knockBack(Entity entityIn, float parFloat1, double parDouble1, double parDouble2) { @@ -896,33 +931,38 @@ public abstract class EntityLivingBase extends Entity { } } - /**+ + /** + * + * Returns the sound this mob makes when it is hurt. */ protected String getHurtSound() { return "game.neutral.hurt"; } - /**+ + /** + * + * Returns the sound this mob makes on death. */ protected String getDeathSound() { return "game.neutral.die"; } - /**+ + /** + * + * Causes this Entity to drop a random item. */ protected void addRandomDrop() { } - /**+ + /** + * + * Drop 0-2 items of this living's type */ protected void dropFewItems(boolean parFlag, int parInt1) { } - /**+ + /** + * + * returns true if this entity is by a ladder, false otherwise */ public boolean isOnLadder() { @@ -934,7 +974,8 @@ public abstract class EntityLivingBase extends Entity { && (!(this instanceof EntityPlayer) || !((EntityPlayer) this).isSpectator()); } - /**+ + /** + * + * Checks whether target entity is alive. */ public boolean isEntityAlive() { @@ -966,7 +1007,8 @@ public abstract class EntityLivingBase extends Entity { return damageValue > 4 ? "game.neutral.hurt.fall.big" : "game.neutral.hurt.fall.small"; } - /**+ + /** + * + * Setups the entity to do the hurt animation. Only used by * packets in multiplayer. */ @@ -975,7 +1017,8 @@ public abstract class EntityLivingBase extends Entity { this.attackedAtYaw = 0.0F; } - /**+ + /** + * + * Returns the current armor value as determined by a call to * InventoryPlayer.getTotalArmorValue */ @@ -995,7 +1038,8 @@ public abstract class EntityLivingBase extends Entity { protected void damageArmor(float parFloat1) { } - /**+ + /** + * + * Reduces damage, depending on armor */ protected float applyArmorCalculations(DamageSource source, float damage) { @@ -1009,7 +1053,8 @@ public abstract class EntityLivingBase extends Entity { return damage; } - /**+ + /** + * + * Reduces damage, depending on potions */ protected float applyPotionDamageCalculations(DamageSource source, float damage) { @@ -1042,7 +1087,8 @@ public abstract class EntityLivingBase extends Entity { } } - /**+ + /** + * + * Deals damage to the entity. If its a EntityPlayer then will * take damage from the armor first and then health second with * the reduced value. Args: damageAmount @@ -1077,7 +1123,8 @@ public abstract class EntityLivingBase extends Entity { return (float) this.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue(); } - /**+ + /** + * + * counts the amount of arrows stuck in the entity. getting hit * by arrows increases this, used in rendering */ @@ -1085,7 +1132,8 @@ public abstract class EntityLivingBase extends Entity { return this.dataWatcher.getWatchableObjectByte(9); } - /**+ + /** + * + * sets the amount of arrows stuck in the entity. used for * rendering those */ @@ -1093,7 +1141,8 @@ public abstract class EntityLivingBase extends Entity { this.dataWatcher.updateObject(9, Byte.valueOf((byte) count)); } - /**+ + /** + * + * Returns an integer indicating the end point of the swing * animation, used by {@link #swingProgress} to provide a * progress indicator. Takes dig speed enchantments into @@ -1107,7 +1156,8 @@ public abstract class EntityLivingBase extends Entity { : 6); } - /**+ + /** + * + * Swings the item the player is holding. */ public void swingItem() { @@ -1151,7 +1201,8 @@ public abstract class EntityLivingBase extends Entity { } - /**+ + /** + * + * sets the dead flag. Used when you fall off the bottom of the * world. */ @@ -1159,7 +1210,8 @@ public abstract class EntityLivingBase extends Entity { this.attackEntityFrom(DamageSource.outOfWorld, 4.0F); } - /**+ + /** + * + * Updates the arm swing progress counters and animation * progress */ @@ -1190,7 +1242,8 @@ public abstract class EntityLivingBase extends Entity { return this.attributeMap; } - /**+ + /** + * + * Get this Entity's EnumCreatureAttribute */ public EnumCreatureAttribute getCreatureAttribute() { @@ -1205,7 +1258,8 @@ public abstract class EntityLivingBase extends Entity { public abstract void setCurrentItemOrArmor(int var1, ItemStack var2); - /**+ + /** + * + * Set sprinting switch for Entity. */ public void setSprinting(boolean flag) { @@ -1223,14 +1277,16 @@ public abstract class EntityLivingBase extends Entity { public abstract ItemStack[] getInventory(); - /**+ + /** + * + * Returns the volume for the sounds this mob makes. */ protected float getSoundVolume() { return 1.0F; } - /**+ + /** + * + * Gets the pitch of living sounds in living entities. */ protected float getSoundPitch() { @@ -1238,14 +1294,16 @@ public abstract class EntityLivingBase extends Entity { : (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F; } - /**+ + /** + * + * Dead and sleeping entities cannot move */ protected boolean isMovementBlocked() { return this.getHealth() <= 0.0F; } - /**+ + /** + * + * Moves the entity to a position out of the way of its mount. */ public void dismountEntity(Entity parEntity) { @@ -1289,7 +1347,8 @@ public abstract class EntityLivingBase extends Entity { return 0.42F; } - /**+ + /** + * + * Causes this entity to do an upwards motion (jumping). */ protected void jump() { @@ -1307,7 +1366,8 @@ public abstract class EntityLivingBase extends Entity { this.isAirBorne = true; } - /**+ + /** + * + * main AI tick function, replaces updateEntityActionState */ protected void updateAITick() { @@ -1318,7 +1378,8 @@ public abstract class EntityLivingBase extends Entity { this.motionY += 0.03999999910593033D; } - /**+ + /** + * + * Moves the entity based on the specified heading. Args: * strafe, forward */ @@ -1442,14 +1503,16 @@ public abstract class EntityLivingBase extends Entity { this.limbSwing += this.limbSwingAmount; } - /**+ + /** + * + * the movespeed used for the new AI system */ public float getAIMoveSpeed() { return this.landMovementFactor; } - /**+ + /** + * + * set the movespeed used for the new AI system */ public void setAIMoveSpeed(float speedIn) { @@ -1461,14 +1524,16 @@ public abstract class EntityLivingBase extends Entity { return false; } - /**+ + /** + * + * Returns whether player is sleeping or not */ public boolean isPlayerSleeping() { return false; } - /**+ + /** + * + * Called to update the entity's position/logic. */ public void onUpdate() { @@ -1598,7 +1663,8 @@ public abstract class EntityLivingBase extends Entity { return parFloat2; } - /**+ + /** + * + * Called frequently so the entity can update its state every * tick as required. For example, zombies and skeletons use this * to react to sunlight and start to burn. @@ -1703,7 +1769,8 @@ public abstract class EntityLivingBase extends Entity { parEntity.applyEntityCollision(this); } - /**+ + /** + * + * Called when a player mounts an entity. e.g. mounts a pig, * mounts a boat. */ @@ -1723,7 +1790,8 @@ public abstract class EntityLivingBase extends Entity { } } - /**+ + /** + * + * Handles updating while being ridden by an entity */ public void updateRidden() { @@ -1746,7 +1814,8 @@ public abstract class EntityLivingBase extends Entity { this.isJumping = parFlag; } - /**+ + /** + * + * Called whenever an item is picked up from walking over it. * Args: pickedUpEntity, stackSize */ @@ -1771,7 +1840,8 @@ public abstract class EntityLivingBase extends Entity { } - /**+ + /** + * + * returns true if the entity provided in the argument can be * seen. (Raytrace) */ @@ -1780,20 +1850,19 @@ public abstract class EntityLivingBase extends Entity { new Vec3(entityIn.posX, entityIn.posY + (double) entityIn.getEyeHeight(), entityIn.posZ)) == null; } - /**+ + /** + * + * returns a (normalized) vector of where this entity is looking */ public Vec3 getLookVec() { return this.getLook(1.0F); } - /**+ + /** + * + * interpolated look vector */ public Vec3 getLook(float f) { - if (this instanceof EntityPlayerSP) { - return super.getLook(f); - } if (f == 1.0F) { return this.getVectorForRotation(this.rotationPitch, this.rotationYawHead); } else { @@ -1803,7 +1872,8 @@ public abstract class EntityLivingBase extends Entity { } } - /**+ + /** + * + * Returns where in the swing animation the living entity is * (from 0 to 1). Args: partialTickTime */ @@ -1816,14 +1886,16 @@ public abstract class EntityLivingBase extends Entity { return this.prevSwingProgress + f * partialTickTime; } - /**+ + /** + * + * Returns whether the entity is in a server world */ public boolean isServerWorld() { return !this.worldObj.isRemote; } - /**+ + /** + * + * Returns true if other Entities should be prevented from * moving through this Entity. */ @@ -1831,7 +1903,8 @@ public abstract class EntityLivingBase extends Entity { return !this.isDead; } - /**+ + /** + * + * Returns true if this entity should push and be pushed by * other entities when colliding. */ @@ -1839,7 +1912,8 @@ public abstract class EntityLivingBase extends Entity { return !this.isDead; } - /**+ + /** + * + * Sets that this entity has been attacked. */ protected void setBeenAttacked() { @@ -1851,7 +1925,8 @@ public abstract class EntityLivingBase extends Entity { return this.rotationYawHead; } - /**+ + /** + * + * Sets the head's yaw rotation of the entity. */ public void setRotationYawHead(float f) { @@ -1882,20 +1957,23 @@ public abstract class EntityLivingBase extends Entity { return this.isOnTeam(otherEntity.getTeam()); } - /**+ + /** + * + * Returns true if the entity is on a specific team. */ public boolean isOnTeam(Team parTeam) { return this.getTeam() != null ? this.getTeam().isSameTeam(parTeam) : false; } - /**+ + /** + * + * Sends an ENTER_COMBAT packet to the client */ public void sendEnterCombat() { } - /**+ + /** + * + * Sends an END_COMBAT packet to the client */ public void sendEndCombat() {