package net.minecraft.world.entity;

import java.util.AbstractList;
import net.minecraft.network.syncher.EntityDataSerializers;
import org.apache.logging.log4j.LogManager;
import net.minecraft.network.chat.Style;
import net.minecraft.network.protocol.Packet;
import net.minecraft.commands.arguments.EntityAnchorArgument;
import net.minecraft.world.level.GameRules;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.level.material.PushReaction;
import java.util.function.Function;
import java.util.Collection;
import java.util.Collections;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.server.level.TicketType;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.scores.PlayerTeam;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.levelgen.Heightmap;
import java.util.Locale;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.ClickEvent;
import com.google.common.collect.Iterables;
import net.minecraft.world.level.block.HoneyBlock;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.state.pattern.BlockPattern;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.NetherPortalBlock;
import net.minecraft.core.Vec3i;
import net.minecraft.world.phys.Vec2;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.level.ItemLike;
import net.minecraft.nbt.FloatTag;
import net.minecraft.nbt.DoubleTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.nbt.StringTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.phys.HitResult;
import net.minecraft.core.particles.BlockParticleOption;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.tags.StaticTagHelper;
import net.minecraft.world.entity.vehicle.Boat;
import net.minecraft.tags.FluidTags;
import java.util.Iterator;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.level.LevelReader;
import net.minecraft.util.RewindableStream;
import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.stream.Stream;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.CollisionContext;
import java.util.Arrays;
import net.minecraft.world.level.block.FenceGateBlock;
import net.minecraft.CrashReportCategory;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.ReportedException;
import net.minecraft.CrashReport;
import net.minecraft.world.level.block.Block;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.item.enchantment.ProtectionEnchantment;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket;
import net.minecraft.world.scores.Team;
import com.google.common.collect.Sets;
import net.minecraft.util.Mth;
import it.unimi.dsi.fastutil.objects.Object2DoubleArrayMap;
import com.google.common.collect.Lists;
import java.util.Set;
import java.util.UUID;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import java.util.Optional;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.tags.Tag;
import it.unimi.dsi.fastutil.objects.Object2DoubleMap;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.level.Level;
import javax.annotation.Nullable;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.item.ItemStack;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.logging.log4j.Logger;
import net.minecraft.commands.CommandSource;
import net.minecraft.world.Nameable;

public abstract class Entity implements Nameable, CommandSource {
    protected static final Logger LOGGER;
    private static final AtomicInteger ENTITY_COUNTER;
    private static final List<ItemStack> EMPTY_LIST;
    private static final AABB INITIAL_AABB;
    private static double viewScale;
    private final EntityType<?> type;
    private int id;
    public boolean blocksBuilding;
    private final List<Entity> passengers;
    protected int boardingCooldown;
    @Nullable
    private Entity vehicle;
    public boolean forcedLoading;
    public Level level;
    public double xo;
    public double yo;
    public double zo;
    private Vec3 position;
    private BlockPos blockPosition;
    private Vec3 deltaMovement;
    public float yRot;
    public float xRot;
    public float yRotO;
    public float xRotO;
    private AABB bb;
    protected boolean onGround;
    public boolean horizontalCollision;
    public boolean verticalCollision;
    public boolean hurtMarked;
    protected Vec3 stuckSpeedMultiplier;
    public boolean removed;
    public float walkDistO;
    public float walkDist;
    public float moveDist;
    public float fallDistance;
    private float nextStep;
    private float nextFlap;
    public double xOld;
    public double yOld;
    public double zOld;
    public float maxUpStep;
    public boolean noPhysics;
    public float pushthrough;
    protected final Random random;
    public int tickCount;
    private int remainingFireTicks;
    protected boolean wasTouchingWater;
    protected Object2DoubleMap<Tag<Fluid>> fluidHeight;
    protected boolean wasEyeInWater;
    @Nullable
    protected Tag<Fluid> fluidOnEyes;
    protected boolean isTouchingLava;
    public int invulnerableTime;
    protected boolean firstTick;
    protected final SynchedEntityData entityData;
    protected static final EntityDataAccessor<Byte> DATA_SHARED_FLAGS_ID;
    private static final EntityDataAccessor<Integer> DATA_AIR_SUPPLY_ID;
    private static final EntityDataAccessor<Optional<Component>> DATA_CUSTOM_NAME;
    private static final EntityDataAccessor<Boolean> DATA_CUSTOM_NAME_VISIBLE;
    private static final EntityDataAccessor<Boolean> DATA_SILENT;
    private static final EntityDataAccessor<Boolean> DATA_NO_GRAVITY;
    protected static final EntityDataAccessor<Pose> DATA_POSE;
    public boolean inChunk;
    public int xChunk;
    public int yChunk;
    public int zChunk;
    private boolean movedSinceLastChunkCheck;
    public long xp;
    public long yp;
    public long zp;
    public boolean noCulling;
    public boolean hasImpulse;
    public int changingDimensionDelay;
    protected boolean isInsidePortal;
    protected int portalTime;
    protected BlockPos portalEntranceBlock;
    protected Vec3 portalEntranceOffset;
    protected Direction portalEntranceForwards;
    private boolean invulnerable;
    protected UUID uuid;
    protected String stringUUID;
    protected boolean glowing;
    private final Set<String> tags;
    private boolean forceChunkAddition;
    private final double[] pistonDeltas;
    private long pistonDeltasGameTime;
    private EntityDimensions dimensions;
    private float eyeHeight;
    
    public Entity(final EntityType<?> aoq, final Level bqb) {
        this.id = Entity.ENTITY_COUNTER.incrementAndGet();
        this.passengers = Lists.newArrayList();
        this.deltaMovement = Vec3.ZERO;
        this.bb = Entity.INITIAL_AABB;
        this.stuckSpeedMultiplier = Vec3.ZERO;
        this.nextStep = 1.0f;
        this.nextFlap = 1.0f;
        this.random = new Random();
        this.remainingFireTicks = -this.getFireImmuneTicks();
        this.fluidHeight = (Object2DoubleMap<Tag<Fluid>>)new Object2DoubleArrayMap(2);
        this.firstTick = true;
        this.uuid = Mth.createInsecureUUID(this.random);
        this.stringUUID = this.uuid.toString();
        this.tags = Sets.newHashSet();
        this.pistonDeltas = new double[] { 0.0, 0.0, 0.0 };
        this.type = aoq;
        this.level = bqb;
        this.dimensions = aoq.getDimensions();
        this.position = Vec3.ZERO;
        this.blockPosition = BlockPos.ZERO;
        this.setPos(0.0, 0.0, 0.0);
        (this.entityData = new SynchedEntityData(this)).<Byte>define(Entity.DATA_SHARED_FLAGS_ID, (Byte)0);
        this.entityData.<Integer>define(Entity.DATA_AIR_SUPPLY_ID, this.getMaxAirSupply());
        this.entityData.<Boolean>define(Entity.DATA_CUSTOM_NAME_VISIBLE, false);
        this.entityData.<Optional<Component>>define(Entity.DATA_CUSTOM_NAME, Optional.<Component>empty());
        this.entityData.<Boolean>define(Entity.DATA_SILENT, false);
        this.entityData.<Boolean>define(Entity.DATA_NO_GRAVITY, false);
        this.entityData.<Pose>define(Entity.DATA_POSE, Pose.STANDING);
        this.defineSynchedData();
        this.eyeHeight = this.getEyeHeight(Pose.STANDING, this.dimensions);
    }
    
    public int getTeamColor() {
        final Team dfo2 = this.getTeam();
        if (dfo2 != null && dfo2.getColor().getColor() != null) {
            return dfo2.getColor().getColor();
        }
        return 16777215;
    }
    
    public boolean isSpectator() {
        return false;
    }
    
    public final void unRide() {
        if (this.isVehicle()) {
            this.ejectPassengers();
        }
        if (this.isPassenger()) {
            this.stopRiding();
        }
    }
    
    public void setPacketCoordinates(final double double1, final double double2, final double double3) {
        this.xp = ClientboundMoveEntityPacket.entityToPacket(double1);
        this.yp = ClientboundMoveEntityPacket.entityToPacket(double2);
        this.zp = ClientboundMoveEntityPacket.entityToPacket(double3);
    }
    
    public EntityType<?> getType() {
        return this.type;
    }
    
    public int getId() {
        return this.id;
    }
    
    public void setId(final int integer) {
        this.id = integer;
    }
    
    public Set<String> getTags() {
        return this.tags;
    }
    
    public boolean addTag(final String string) {
        return this.tags.size() < 1024 && this.tags.add(string);
    }
    
    public boolean removeTag(final String string) {
        return this.tags.remove(string);
    }
    
    public void kill() {
        this.remove();
    }
    
    protected abstract void defineSynchedData();
    
    public SynchedEntityData getEntityData() {
        return this.entityData;
    }
    
    @Override
    public boolean equals(final Object object) {
        return object instanceof Entity && ((Entity)object).id == this.id;
    }
    
    @Override
    public int hashCode() {
        return this.id;
    }
    
    protected void resetPos() {
        if (this.level == null) {
            return;
        }
        for (double double2 = this.getY(); double2 > 0.0 && double2 < 256.0; ++double2) {
            this.setPos(this.getX(), double2, this.getZ());
            if (this.level.noCollision(this)) {
                break;
            }
        }
        this.setDeltaMovement(Vec3.ZERO);
        this.xRot = 0.0f;
    }
    
    public void remove() {
        this.removed = true;
    }
    
    public void setPose(final Pose apj) {
        this.entityData.<Pose>set(Entity.DATA_POSE, apj);
    }
    
    public Pose getPose() {
        return this.entityData.<Pose>get(Entity.DATA_POSE);
    }
    
    public boolean closerThan(final Entity aom, final double double2) {
        final double double3 = aom.position.x - this.position.x;
        final double double4 = aom.position.y - this.position.y;
        final double double5 = aom.position.z - this.position.z;
        return double3 * double3 + double4 * double4 + double5 * double5 < double2 * double2;
    }
    
    protected void setRot(final float float1, final float float2) {
        this.yRot = float1 % 360.0f;
        this.xRot = float2 % 360.0f;
    }
    
    public void setPos(final double double1, final double double2, final double double3) {
        this.setPosRaw(double1, double2, double3);
        final float float8 = this.dimensions.width / 2.0f;
        final float float9 = this.dimensions.height;
        this.setBoundingBox(new AABB(double1 - float8, double2, double3 - float8, double1 + float8, double2 + float9, double3 + float8));
    }
    
    protected void reapplyPosition() {
        this.setPos(this.position.x, this.position.y, this.position.z);
    }
    
    public void turn(final double double1, final double double2) {
        final double double3 = double2 * 0.15;
        final double double4 = double1 * 0.15;
        this.xRot += (float)double3;
        this.yRot += (float)double4;
        this.xRot = Mth.clamp(this.xRot, -90.0f, 90.0f);
        this.xRotO += (float)double3;
        this.yRotO += (float)double4;
        this.xRotO = Mth.clamp(this.xRotO, -90.0f, 90.0f);
        if (this.vehicle != null) {
            this.vehicle.onPassengerTurned(this);
        }
    }
    
    public void tick() {
        if (!this.level.isClientSide) {
            this.setSharedFlag(6, this.isGlowing());
        }
        this.baseTick();
    }
    
    public void baseTick() {
        this.level.getProfiler().push("entityBaseTick");
        if (this.isPassenger() && this.getVehicle().removed) {
            this.stopRiding();
        }
        if (this.boardingCooldown > 0) {
            --this.boardingCooldown;
        }
        this.walkDistO = this.walkDist;
        this.xRotO = this.xRot;
        this.yRotO = this.yRot;
        this.handleNetherPortal();
        if (this.canSpawnSprintParticle()) {
            this.spawnSprintParticle();
        }
        this.updateInWaterStateAndDoFluidPushing();
        this.updateFluidOnEyes();
        this.updateSwimming();
        if (this.level.isClientSide) {
            this.clearFire();
        }
        else if (this.remainingFireTicks > 0) {
            if (this.fireImmune()) {
                this.setRemainingFireTicks(this.remainingFireTicks - 4);
                if (this.remainingFireTicks < 0) {
                    this.clearFire();
                }
            }
            else {
                if (this.remainingFireTicks % 20 == 0) {
                    this.hurt(DamageSource.ON_FIRE, 1.0f);
                }
                this.setRemainingFireTicks(this.remainingFireTicks - 1);
            }
        }
        if (this.isInLava()) {
            this.lavaHurt();
            this.fallDistance *= 0.5f;
        }
        if (this.getY() < -64.0) {
            this.outOfWorld();
        }
        if (!this.level.isClientSide) {
            this.setSharedFlag(0, this.remainingFireTicks > 0);
        }
        this.firstTick = false;
        this.level.getProfiler().pop();
    }
    
    protected void processDimensionDelay() {
        if (this.changingDimensionDelay > 0) {
            --this.changingDimensionDelay;
        }
    }
    
    public int getPortalWaitTime() {
        return 1;
    }
    
    protected void lavaHurt() {
        if (this.fireImmune()) {
            return;
        }
        this.setSecondsOnFire(15);
        this.hurt(DamageSource.LAVA, 4.0f);
    }
    
    public void setSecondsOnFire(final int integer) {
        int integer2 = integer * 20;
        if (this instanceof LivingEntity) {
            integer2 = ProtectionEnchantment.getFireAfterDampener((LivingEntity)this, integer2);
        }
        if (this.remainingFireTicks < integer2) {
            this.setRemainingFireTicks(integer2);
        }
    }
    
    public void setRemainingFireTicks(final int integer) {
        this.remainingFireTicks = integer;
    }
    
    public int getRemainingFireTicks() {
        return this.remainingFireTicks;
    }
    
    public void clearFire() {
        this.setRemainingFireTicks(0);
    }
    
    protected void outOfWorld() {
        this.remove();
    }
    
    public boolean isFree(final double double1, final double double2, final double double3) {
        return this.isFree(this.getBoundingBox().move(double1, double2, double3));
    }
    
    private boolean isFree(final AABB deg) {
        return this.level.noCollision(this, deg) && !this.level.containsAnyLiquid(deg);
    }
    
    public void setOnGround(final boolean boolean1) {
        this.onGround = boolean1;
    }
    
    public boolean isOnGround() {
        return this.onGround;
    }
    
    public void move(final MoverType apd, Vec3 dem) {
        if (this.noPhysics) {
            this.setBoundingBox(this.getBoundingBox().move(dem));
            this.setLocationFromBoundingbox();
            return;
        }
        if (apd == MoverType.PISTON) {
            dem = this.limitPistonMovement(dem);
            if (dem.equals(Vec3.ZERO)) {
                return;
            }
        }
        this.level.getProfiler().push("move");
        if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) {
            dem = dem.multiply(this.stuckSpeedMultiplier);
            this.stuckSpeedMultiplier = Vec3.ZERO;
            this.setDeltaMovement(Vec3.ZERO);
        }
        dem = this.maybeBackOffFromEdge(dem, apd);
        final Vec3 dem2 = this.collide(dem);
        if (dem2.lengthSqr() > 1.0E-7) {
            this.setBoundingBox(this.getBoundingBox().move(dem2));
            this.setLocationFromBoundingbox();
        }
        this.level.getProfiler().pop();
        this.level.getProfiler().push("rest");
        this.horizontalCollision = (!Mth.equal(dem.x, dem2.x) || !Mth.equal(dem.z, dem2.z));
        this.verticalCollision = (dem.y != dem2.y);
        this.onGround = (this.verticalCollision && dem.y < 0.0);
        final BlockPos fu5 = this.getOnPos();
        final BlockState cfj2 = this.level.getBlockState(fu5);
        this.checkFallDamage(dem2.y, this.onGround, cfj2, fu5);
        final Vec3 dem3 = this.getDeltaMovement();
        if (dem.x != dem2.x) {
            this.setDeltaMovement(0.0, dem3.y, dem3.z);
        }
        if (dem.z != dem2.z) {
            this.setDeltaMovement(dem3.x, dem3.y, 0.0);
        }
        final Block bvr8 = cfj2.getBlock();
        if (dem.y != dem2.y) {
            bvr8.updateEntityAfterFallOn(this.level, this);
        }
        if (this.onGround && !this.isSteppingCarefully()) {
            bvr8.stepOn(this.level, fu5, this);
        }
        if (this.isMovementNoisy() && !this.isPassenger()) {
            final double double9 = dem2.x;
            double double10 = dem2.y;
            final double double11 = dem2.z;
            if (!bvr8.is(BlockTags.CLIMBABLE)) {
                double10 = 0.0;
            }
            this.walkDist += (float)(Mth.sqrt(getHorizontalDistanceSqr(dem2)) * 0.6);
            this.moveDist += (float)(Mth.sqrt(double9 * double9 + double10 * double10 + double11 * double11) * 0.6);
            if (this.moveDist > this.nextStep && !cfj2.isAir()) {
                this.nextStep = this.nextStep();
                if (this.isInWater()) {
                    final Entity aom15 = (this.isVehicle() && this.getControllingPassenger() != null) ? this.getControllingPassenger() : this;
                    final float float16 = (aom15 == this) ? 0.35f : 0.4f;
                    final Vec3 dem4 = aom15.getDeltaMovement();
                    float float17 = Mth.sqrt(dem4.x * dem4.x * 0.20000000298023224 + dem4.y * dem4.y + dem4.z * dem4.z * 0.20000000298023224) * float16;
                    if (float17 > 1.0f) {
                        float17 = 1.0f;
                    }
                    this.playSwimSound(float17);
                }
                else {
                    this.playStepSound(fu5, cfj2);
                }
            }
            else if (this.moveDist > this.nextFlap && this.makeFlySound() && cfj2.isAir()) {
                this.nextFlap = this.playFlySound(this.moveDist);
            }
        }
        try {
            this.isTouchingLava = false;
            this.checkInsideBlocks();
        }
        catch (Throwable throwable9) {
            final CrashReport j10 = CrashReport.forThrowable(throwable9, "Checking entity block collision");
            final CrashReportCategory k11 = j10.addCategory("Entity being checked for collision");
            this.fillCrashReportCategory(k11);
            throw new ReportedException(j10);
        }
        final float float18 = this.getBlockSpeedFactor();
        this.setDeltaMovement(this.getDeltaMovement().multiply(float18, 1.0, float18));
        if (this.level.getBlockStatesIfLoaded(this.getBoundingBox().deflate(0.001)).noneMatch(cfj -> cfj.is(BlockTags.FIRE) || cfj.is(Blocks.LAVA)) && this.remainingFireTicks <= 0) {
            this.setRemainingFireTicks(-this.getFireImmuneTicks());
        }
        if (this.isInWaterRainOrBubble() && this.isOnFire()) {
            this.playSound(SoundEvents.GENERIC_EXTINGUISH_FIRE, 0.7f, 1.6f + (this.random.nextFloat() - this.random.nextFloat()) * 0.4f);
            this.setRemainingFireTicks(-this.getFireImmuneTicks());
        }
        this.level.getProfiler().pop();
    }
    
    protected BlockPos getOnPos() {
        final int integer2 = Mth.floor(this.position.x);
        final int integer3 = Mth.floor(this.position.y - 0.20000000298023224);
        final int integer4 = Mth.floor(this.position.z);
        final BlockPos fu5 = new BlockPos(integer2, integer3, integer4);
        if (this.level.getBlockState(fu5).isAir()) {
            final BlockPos fu6 = fu5.below();
            final BlockState cfj7 = this.level.getBlockState(fu6);
            final Block bvr8 = cfj7.getBlock();
            if (bvr8.is(BlockTags.FENCES) || bvr8.is(BlockTags.WALLS) || bvr8 instanceof FenceGateBlock) {
                return fu6;
            }
        }
        return fu5;
    }
    
    protected float getBlockJumpFactor() {
        final float float2 = this.level.getBlockState(this.blockPosition()).getBlock().getJumpFactor();
        final float float3 = this.level.getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getJumpFactor();
        return (float2 == 1.0) ? float3 : float2;
    }
    
    protected float getBlockSpeedFactor() {
        final Block bvr2 = this.level.getBlockState(this.blockPosition()).getBlock();
        final float float3 = bvr2.getSpeedFactor();
        if (bvr2 == Blocks.WATER || bvr2 == Blocks.BUBBLE_COLUMN) {
            return float3;
        }
        return (float3 == 1.0) ? this.level.getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getSpeedFactor() : float3;
    }
    
    protected BlockPos getBlockPosBelowThatAffectsMyMovement() {
        return new BlockPos(this.position.x, this.getBoundingBox().minY - 0.5000001, this.position.z);
    }
    
    protected Vec3 maybeBackOffFromEdge(final Vec3 dem, final MoverType apd) {
        return dem;
    }
    
    protected Vec3 limitPistonMovement(final Vec3 dem) {
        if (dem.lengthSqr() <= 1.0E-7) {
            return dem;
        }
        final long long3 = this.level.getGameTime();
        if (long3 != this.pistonDeltasGameTime) {
            Arrays.fill(this.pistonDeltas, 0.0);
            this.pistonDeltasGameTime = long3;
        }
        if (dem.x != 0.0) {
            final double double5 = this.applyPistonMovementRestriction(Direction.Axis.X, dem.x);
            return (Math.abs(double5) <= 9.999999747378752E-6) ? Vec3.ZERO : new Vec3(double5, 0.0, 0.0);
        }
        if (dem.y != 0.0) {
            final double double5 = this.applyPistonMovementRestriction(Direction.Axis.Y, dem.y);
            return (Math.abs(double5) <= 9.999999747378752E-6) ? Vec3.ZERO : new Vec3(0.0, double5, 0.0);
        }
        if (dem.z != 0.0) {
            final double double5 = this.applyPistonMovementRestriction(Direction.Axis.Z, dem.z);
            return (Math.abs(double5) <= 9.999999747378752E-6) ? Vec3.ZERO : new Vec3(0.0, 0.0, double5);
        }
        return Vec3.ZERO;
    }
    
    private double applyPistonMovementRestriction(final Direction.Axis a, double double2) {
        final int integer5 = a.ordinal();
        final double double3 = Mth.clamp(double2 + this.pistonDeltas[integer5], -0.51, 0.51);
        double2 = double3 - this.pistonDeltas[integer5];
        this.pistonDeltas[integer5] = double3;
        return double2;
    }
    
    private Vec3 collide(final Vec3 dem) {
        final AABB deg3 = this.getBoundingBox();
        final CollisionContext der4 = CollisionContext.of(this);
        final VoxelShape dfg5 = this.level.getWorldBorder().getCollisionShape();
        final Stream<VoxelShape> stream6 = Shapes.joinIsNotEmpty(dfg5, Shapes.create(deg3.deflate(1.0E-7)), BooleanOp.AND) ? Stream.<VoxelShape>empty() : Stream.<VoxelShape>of(dfg5);
        final Stream<VoxelShape> stream7 = this.level.getEntityCollisions(this, deg3.expandTowards(dem), aom -> true);
        final RewindableStream<VoxelShape> aee8 = new RewindableStream<VoxelShape>(Stream.<VoxelShape>concat(stream7, stream6));
        final Vec3 dem2 = (dem.lengthSqr() == 0.0) ? dem : collideBoundingBoxHeuristically(this, dem, deg3, this.level, der4, aee8);
        final boolean boolean10 = dem.x != dem2.x;
        final boolean boolean11 = dem.y != dem2.y;
        final boolean boolean12 = dem.z != dem2.z;
        final boolean boolean13 = this.onGround || (boolean11 && dem.y < 0.0);
        if (this.maxUpStep > 0.0f && boolean13 && (boolean10 || boolean12)) {
            Vec3 dem3 = collideBoundingBoxHeuristically(this, new Vec3(dem.x, this.maxUpStep, dem.z), deg3, this.level, der4, aee8);
            final Vec3 dem4 = collideBoundingBoxHeuristically(this, new Vec3(0.0, this.maxUpStep, 0.0), deg3.expandTowards(dem.x, 0.0, dem.z), this.level, der4, aee8);
            if (dem4.y < this.maxUpStep) {
                final Vec3 dem5 = collideBoundingBoxHeuristically(this, new Vec3(dem.x, 0.0, dem.z), deg3.move(dem4), this.level, der4, aee8).add(dem4);
                if (getHorizontalDistanceSqr(dem5) > getHorizontalDistanceSqr(dem3)) {
                    dem3 = dem5;
                }
            }
            if (getHorizontalDistanceSqr(dem3) > getHorizontalDistanceSqr(dem2)) {
                return dem3.add(collideBoundingBoxHeuristically(this, new Vec3(0.0, -dem3.y + dem.y, 0.0), deg3.move(dem3), this.level, der4, aee8));
            }
        }
        return dem2;
    }
    
    public static double getHorizontalDistanceSqr(final Vec3 dem) {
        return dem.x * dem.x + dem.z * dem.z;
    }
    
    public static Vec3 collideBoundingBoxHeuristically(@Nullable final Entity aom, final Vec3 dem, final AABB deg, final Level bqb, final CollisionContext der, final RewindableStream<VoxelShape> aee) {
        final boolean boolean7 = dem.x == 0.0;
        final boolean boolean8 = dem.y == 0.0;
        final boolean boolean9 = dem.z == 0.0;
        if ((boolean7 && boolean8) || (boolean7 && boolean9) || (boolean8 && boolean9)) {
            return collideBoundingBox(dem, deg, bqb, der, aee);
        }
        final RewindableStream<VoxelShape> aee2 = new RewindableStream<VoxelShape>(Stream.<VoxelShape>concat(aee.getStream(), bqb.getBlockCollisions(aom, deg.expandTowards(dem))));
        return collideBoundingBoxLegacy(dem, deg, aee2);
    }
    
    public static Vec3 collideBoundingBoxLegacy(final Vec3 dem, AABB deg, final RewindableStream<VoxelShape> aee) {
        double double4 = dem.x;
        double double5 = dem.y;
        double double6 = dem.z;
        if (double5 != 0.0) {
            double5 = Shapes.collide(Direction.Axis.Y, deg, aee.getStream(), double5);
            if (double5 != 0.0) {
                deg = deg.move(0.0, double5, 0.0);
            }
        }
        final boolean boolean10 = Math.abs(double4) < Math.abs(double6);
        if (boolean10 && double6 != 0.0) {
            double6 = Shapes.collide(Direction.Axis.Z, deg, aee.getStream(), double6);
            if (double6 != 0.0) {
                deg = deg.move(0.0, 0.0, double6);
            }
        }
        if (double4 != 0.0) {
            double4 = Shapes.collide(Direction.Axis.X, deg, aee.getStream(), double4);
            if (!boolean10 && double4 != 0.0) {
                deg = deg.move(double4, 0.0, 0.0);
            }
        }
        if (!boolean10 && double6 != 0.0) {
            double6 = Shapes.collide(Direction.Axis.Z, deg, aee.getStream(), double6);
        }
        return new Vec3(double4, double5, double6);
    }
    
    public static Vec3 collideBoundingBox(final Vec3 dem, AABB deg, final LevelReader bqd, final CollisionContext der, final RewindableStream<VoxelShape> aee) {
        double double6 = dem.x;
        double double7 = dem.y;
        double double8 = dem.z;
        if (double7 != 0.0) {
            double7 = Shapes.collide(Direction.Axis.Y, deg, bqd, double7, der, aee.getStream());
            if (double7 != 0.0) {
                deg = deg.move(0.0, double7, 0.0);
            }
        }
        final boolean boolean12 = Math.abs(double6) < Math.abs(double8);
        if (boolean12 && double8 != 0.0) {
            double8 = Shapes.collide(Direction.Axis.Z, deg, bqd, double8, der, aee.getStream());
            if (double8 != 0.0) {
                deg = deg.move(0.0, 0.0, double8);
            }
        }
        if (double6 != 0.0) {
            double6 = Shapes.collide(Direction.Axis.X, deg, bqd, double6, der, aee.getStream());
            if (!boolean12 && double6 != 0.0) {
                deg = deg.move(double6, 0.0, 0.0);
            }
        }
        if (!boolean12 && double8 != 0.0) {
            double8 = Shapes.collide(Direction.Axis.Z, deg, bqd, double8, der, aee.getStream());
        }
        return new Vec3(double6, double7, double8);
    }
    
    protected float nextStep() {
        return (float)((int)this.moveDist + 1);
    }
    
    public void setLocationFromBoundingbox() {
        final AABB deg2 = this.getBoundingBox();
        this.setPosRaw((deg2.minX + deg2.maxX) / 2.0, deg2.minY, (deg2.minZ + deg2.maxZ) / 2.0);
    }
    
    protected SoundEvent getSwimSound() {
        return SoundEvents.GENERIC_SWIM;
    }
    
    protected SoundEvent getSwimSplashSound() {
        return SoundEvents.GENERIC_SPLASH;
    }
    
    protected SoundEvent getSwimHighSpeedSplashSound() {
        return SoundEvents.GENERIC_SPLASH;
    }
    
    protected void checkInsideBlocks() {
        final AABB deg2 = this.getBoundingBox();
        final BlockPos fu3 = new BlockPos(deg2.minX + 0.001, deg2.minY + 0.001, deg2.minZ + 0.001);
        final BlockPos fu4 = new BlockPos(deg2.maxX - 0.001, deg2.maxY - 0.001, deg2.maxZ - 0.001);
        final BlockPos.MutableBlockPos a5 = new BlockPos.MutableBlockPos();
        if (this.level.hasChunksAt(fu3, fu4)) {
            for (int integer6 = fu3.getX(); integer6 <= fu4.getX(); ++integer6) {
                for (int integer7 = fu3.getY(); integer7 <= fu4.getY(); ++integer7) {
                    for (int integer8 = fu3.getZ(); integer8 <= fu4.getZ(); ++integer8) {
                        a5.set(integer6, integer7, integer8);
                        final BlockState cfj9 = this.level.getBlockState(a5);
                        try {
                            cfj9.entityInside(this.level, a5, this);
                            this.onInsideBlock(cfj9);
                        }
                        catch (Throwable throwable10) {
                            final CrashReport j11 = CrashReport.forThrowable(throwable10, "Colliding entity with block");
                            final CrashReportCategory k12 = j11.addCategory("Block being collided with");
                            CrashReportCategory.populateBlockDetails(k12, a5, cfj9);
                            throw new ReportedException(j11);
                        }
                    }
                }
            }
        }
    }
    
    protected void onInsideBlock(final BlockState cfj) {
    }
    
    protected void playStepSound(final BlockPos fu, final BlockState cfj) {
        if (cfj.getMaterial().isLiquid()) {
            return;
        }
        final BlockState cfj2 = this.level.getBlockState(fu.above());
        final SoundType cbh5 = cfj2.is(Blocks.SNOW) ? cfj2.getSoundType() : cfj.getSoundType();
        this.playSound(cbh5.getStepSound(), cbh5.getVolume() * 0.15f, cbh5.getPitch());
    }
    
    protected void playSwimSound(final float float1) {
        this.playSound(this.getSwimSound(), float1, 1.0f + (this.random.nextFloat() - this.random.nextFloat()) * 0.4f);
    }
    
    protected float playFlySound(final float float1) {
        return 0.0f;
    }
    
    protected boolean makeFlySound() {
        return false;
    }
    
    public void playSound(final SoundEvent ack, final float float2, final float float3) {
        if (!this.isSilent()) {
            this.level.playSound(null, this.getX(), this.getY(), this.getZ(), ack, this.getSoundSource(), float2, float3);
        }
    }
    
    public boolean isSilent() {
        return this.entityData.<Boolean>get(Entity.DATA_SILENT);
    }
    
    public void setSilent(final boolean boolean1) {
        this.entityData.<Boolean>set(Entity.DATA_SILENT, boolean1);
    }
    
    public boolean isNoGravity() {
        return this.entityData.<Boolean>get(Entity.DATA_NO_GRAVITY);
    }
    
    public void setNoGravity(final boolean boolean1) {
        this.entityData.<Boolean>set(Entity.DATA_NO_GRAVITY, boolean1);
    }
    
    protected boolean isMovementNoisy() {
        return true;
    }
    
    protected void checkFallDamage(final double double1, final boolean boolean2, final BlockState cfj, final BlockPos fu) {
        if (boolean2) {
            if (this.fallDistance > 0.0f) {
                cfj.getBlock().fallOn(this.level, fu, this, this.fallDistance);
            }
            this.fallDistance = 0.0f;
        }
        else if (double1 < 0.0) {
            this.fallDistance -= (float)double1;
        }
    }
    
    @Nullable
    public AABB getCollideBox() {
        return null;
    }
    
    public boolean fireImmune() {
        return this.getType().fireImmune();
    }
    
    public boolean causeFallDamage(final float float1, final float float2) {
        if (this.isVehicle()) {
            for (final Entity aom5 : this.getPassengers()) {
                aom5.causeFallDamage(float1, float2);
            }
        }
        return false;
    }
    
    public boolean isInWater() {
        return this.wasTouchingWater;
    }
    
    private boolean isInRain() {
        final BlockPos fu2 = this.blockPosition();
        return this.level.isRainingAt(fu2) || this.level.isRainingAt(fu2.offset(0.0, this.dimensions.height, 0.0));
    }
    
    private boolean isInBubbleColumn() {
        return this.level.getBlockState(this.blockPosition()).is(Blocks.BUBBLE_COLUMN);
    }
    
    public boolean isInWaterOrRain() {
        return this.isInWater() || this.isInRain();
    }
    
    public boolean isInWaterRainOrBubble() {
        return this.isInWater() || this.isInRain() || this.isInBubbleColumn();
    }
    
    public boolean isInWaterOrBubble() {
        return this.isInWater() || this.isInBubbleColumn();
    }
    
    public boolean isUnderWater() {
        return this.wasEyeInWater && this.isInWater();
    }
    
    public void updateSwimming() {
        if (this.isSwimming()) {
            this.setSwimming(this.isSprinting() && this.isInWater() && !this.isPassenger());
        }
        else {
            this.setSwimming(this.isSprinting() && this.isUnderWater() && !this.isPassenger());
        }
    }
    
    protected boolean updateInWaterStateAndDoFluidPushing() {
        this.fluidHeight.clear();
        this.updateInWaterStateAndDoWaterCurrentPushing();
        if (this.isInWater()) {
            return true;
        }
        final double double2 = this.level.dimensionType().ultraWarm() ? 0.007 : 0.0023333333333333335;
        return this.updateFluidHeightAndDoFluidPushing(FluidTags.LAVA, double2);
    }
    
    void updateInWaterStateAndDoWaterCurrentPushing() {
        if (this.getVehicle() instanceof Boat) {
            this.wasTouchingWater = false;
        }
        else if (this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014)) {
            if (!this.wasTouchingWater && !this.firstTick) {
                this.doWaterSplashEffect();
            }
            this.fallDistance = 0.0f;
            this.wasTouchingWater = true;
            this.clearFire();
        }
        else {
            this.wasTouchingWater = false;
        }
    }
    
    private void updateFluidOnEyes() {
        this.wasEyeInWater = this.isEyeInFluid(FluidTags.WATER);
        this.fluidOnEyes = null;
        final double double2 = this.getEyeY() - 0.1111111119389534;
        final Vec3 dem4 = new Vec3(this.getX(), double2, this.getZ());
        final Entity aom5 = this.getVehicle();
        if (aom5 instanceof Boat) {
            final Boat bft6 = (Boat)aom5;
            if (!bft6.isUnderWater() && bft6.getBoundingBox().contains(dem4)) {
                return;
            }
        }
        final BlockPos fu6 = new BlockPos(dem4);
        final FluidState cxa7 = this.level.getFluidState(fu6);
        for (final Tag<Fluid> adf9 : FluidTags.getWrappers()) {
            if (cxa7.is(adf9)) {
                final double double3 = fu6.getY() + cxa7.getHeight(this.level, fu6);
                if (double3 > double2) {
                    this.fluidOnEyes = adf9;
                }
            }
        }
    }
    
    protected void doWaterSplashEffect() {
        final Entity aom2 = (this.isVehicle() && this.getControllingPassenger() != null) ? this.getControllingPassenger() : this;
        final float float3 = (aom2 == this) ? 0.2f : 0.9f;
        final Vec3 dem4 = aom2.getDeltaMovement();
        float float4 = Mth.sqrt(dem4.x * dem4.x * 0.20000000298023224 + dem4.y * dem4.y + dem4.z * dem4.z * 0.20000000298023224) * float3;
        if (float4 > 1.0f) {
            float4 = 1.0f;
        }
        if (float4 < 0.25) {
            this.playSound(this.getSwimSplashSound(), float4, 1.0f + (this.random.nextFloat() - this.random.nextFloat()) * 0.4f);
        }
        else {
            this.playSound(this.getSwimHighSpeedSplashSound(), float4, 1.0f + (this.random.nextFloat() - this.random.nextFloat()) * 0.4f);
        }
        final float float5 = (float)Mth.floor(this.getY());
        for (int integer7 = 0; integer7 < 1.0f + this.dimensions.width * 20.0f; ++integer7) {
            final double double8 = (this.random.nextDouble() * 2.0 - 1.0) * this.dimensions.width;
            final double double9 = (this.random.nextDouble() * 2.0 - 1.0) * this.dimensions.width;
            this.level.addParticle(ParticleTypes.BUBBLE, this.getX() + double8, float5 + 1.0f, this.getZ() + double9, dem4.x, dem4.y - this.random.nextDouble() * 0.20000000298023224, dem4.z);
        }
        for (int integer7 = 0; integer7 < 1.0f + this.dimensions.width * 20.0f; ++integer7) {
            final double double8 = (this.random.nextDouble() * 2.0 - 1.0) * this.dimensions.width;
            final double double9 = (this.random.nextDouble() * 2.0 - 1.0) * this.dimensions.width;
            this.level.addParticle(ParticleTypes.SPLASH, this.getX() + double8, float5 + 1.0f, this.getZ() + double9, dem4.x, dem4.y, dem4.z);
        }
    }
    
    protected BlockState getBlockStateOn() {
        return this.level.getBlockState(this.getOnPos());
    }
    
    public boolean canSpawnSprintParticle() {
        return this.isSprinting() && !this.isInWater() && !this.isSpectator() && !this.isCrouching() && !this.isInLava() && this.isAlive();
    }
    
    protected void spawnSprintParticle() {
        final int integer2 = Mth.floor(this.getX());
        final int integer3 = Mth.floor(this.getY() - 0.20000000298023224);
        final int integer4 = Mth.floor(this.getZ());
        final BlockPos fu5 = new BlockPos(integer2, integer3, integer4);
        final BlockState cfj6 = this.level.getBlockState(fu5);
        if (cfj6.getRenderShape() != RenderShape.INVISIBLE) {
            final Vec3 dem7 = this.getDeltaMovement();
            this.level.addParticle(new BlockParticleOption(ParticleTypes.BLOCK, cfj6), this.getX() + (this.random.nextDouble() - 0.5) * this.dimensions.width, this.getY() + 0.1, this.getZ() + (this.random.nextDouble() - 0.5) * this.dimensions.width, dem7.x * -4.0, 1.5, dem7.z * -4.0);
        }
    }
    
    public boolean isEyeInFluid(final Tag<Fluid> adf) {
        return this.fluidOnEyes == adf;
    }
    
    public void setInLava() {
        this.isTouchingLava = true;
    }
    
    public boolean isInLava() {
        return this.isTouchingLava;
    }
    
    public void moveRelative(final float float1, final Vec3 dem) {
        final Vec3 dem2 = getInputVector(dem, float1, this.yRot);
        this.setDeltaMovement(this.getDeltaMovement().add(dem2));
    }
    
    private static Vec3 getInputVector(final Vec3 dem, final float float2, final float float3) {
        final double double4 = dem.lengthSqr();
        if (double4 < 1.0E-7) {
            return Vec3.ZERO;
        }
        final Vec3 dem2 = ((double4 > 1.0) ? dem.normalize() : dem).scale(float2);
        final float float4 = Mth.sin(float3 * 0.017453292f);
        final float float5 = Mth.cos(float3 * 0.017453292f);
        return new Vec3(dem2.x * float5 - dem2.z * float4, dem2.y, dem2.z * float5 + dem2.x * float4);
    }
    
    public float getBrightness() {
        final BlockPos.MutableBlockPos a2 = new BlockPos.MutableBlockPos(this.getX(), 0.0, this.getZ());
        if (this.level.hasChunkAt(a2)) {
            a2.setY(Mth.floor(this.getEyeY()));
            return this.level.getBrightness(a2);
        }
        return 0.0f;
    }
    
    public void setLevel(final Level bqb) {
        this.level = bqb;
    }
    
    public void absMoveTo(final double double1, final double double2, final double double3, final float float4, final float float5) {
        final double double4 = Mth.clamp(double1, -3.0E7, 3.0E7);
        final double double5 = Mth.clamp(double3, -3.0E7, 3.0E7);
        this.setPos(this.xo = double4, this.yo = double2, this.zo = double5);
        this.yRot = float4 % 360.0f;
        this.xRot = Mth.clamp(float5, -90.0f, 90.0f) % 360.0f;
        this.yRotO = this.yRot;
        this.xRotO = this.xRot;
    }
    
    public void moveTo(final Vec3 dem) {
        this.moveTo(dem.x, dem.y, dem.z);
    }
    
    public void moveTo(final double double1, final double double2, final double double3) {
        this.moveTo(double1, double2, double3, this.yRot, this.xRot);
    }
    
    public void moveTo(final BlockPos fu, final float float2, final float float3) {
        this.moveTo(fu.getX() + 0.5, fu.getY(), fu.getZ() + 0.5, float2, float3);
    }
    
    public void moveTo(final double double1, final double double2, final double double3, final float float4, final float float5) {
        this.setPosAndOldPos(double1, double2, double3);
        this.yRot = float4;
        this.xRot = float5;
        this.reapplyPosition();
    }
    
    public void setPosAndOldPos(final double double1, final double double2, final double double3) {
        this.setPosRaw(double1, double2, double3);
        this.xo = double1;
        this.yo = double2;
        this.zo = double3;
        this.xOld = double1;
        this.yOld = double2;
        this.zOld = double3;
    }
    
    public float distanceTo(final Entity aom) {
        final float float3 = (float)(this.getX() - aom.getX());
        final float float4 = (float)(this.getY() - aom.getY());
        final float float5 = (float)(this.getZ() - aom.getZ());
        return Mth.sqrt(float3 * float3 + float4 * float4 + float5 * float5);
    }
    
    public double distanceToSqr(final double double1, final double double2, final double double3) {
        final double double4 = this.getX() - double1;
        final double double5 = this.getY() - double2;
        final double double6 = this.getZ() - double3;
        return double4 * double4 + double5 * double5 + double6 * double6;
    }
    
    public double distanceToSqr(final Entity aom) {
        return this.distanceToSqr(aom.position());
    }
    
    public double distanceToSqr(final Vec3 dem) {
        final double double3 = this.getX() - dem.x;
        final double double4 = this.getY() - dem.y;
        final double double5 = this.getZ() - dem.z;
        return double3 * double3 + double4 * double4 + double5 * double5;
    }
    
    public void playerTouch(final Player bec) {
    }
    
    public void push(final Entity aom) {
        if (this.isPassengerOfSameVehicle(aom)) {
            return;
        }
        if (aom.noPhysics || this.noPhysics) {
            return;
        }
        double double3 = aom.getX() - this.getX();
        double double4 = aom.getZ() - this.getZ();
        double double5 = Mth.absMax(double3, double4);
        if (double5 >= 0.009999999776482582) {
            double5 = Mth.sqrt(double5);
            double3 /= double5;
            double4 /= double5;
            double double6 = 1.0 / double5;
            if (double6 > 1.0) {
                double6 = 1.0;
            }
            double3 *= double6;
            double4 *= double6;
            double3 *= 0.05000000074505806;
            double4 *= 0.05000000074505806;
            double3 *= 1.0f - this.pushthrough;
            double4 *= 1.0f - this.pushthrough;
            if (!this.isVehicle()) {
                this.push(-double3, 0.0, -double4);
            }
            if (!aom.isVehicle()) {
                aom.push(double3, 0.0, double4);
            }
        }
    }
    
    public void push(final double double1, final double double2, final double double3) {
        this.setDeltaMovement(this.getDeltaMovement().add(double1, double2, double3));
        this.hasImpulse = true;
    }
    
    protected void markHurt() {
        this.hurtMarked = true;
    }
    
    public boolean hurt(final DamageSource anw, final float float2) {
        if (this.isInvulnerableTo(anw)) {
            return false;
        }
        this.markHurt();
        return false;
    }
    
    public final Vec3 getViewVector(final float float1) {
        return this.calculateViewVector(this.getViewXRot(float1), this.getViewYRot(float1));
    }
    
    public float getViewXRot(final float float1) {
        if (float1 == 1.0f) {
            return this.xRot;
        }
        return Mth.lerp(float1, this.xRotO, this.xRot);
    }
    
    public float getViewYRot(final float float1) {
        if (float1 == 1.0f) {
            return this.yRot;
        }
        return Mth.lerp(float1, this.yRotO, this.yRot);
    }
    
    protected final Vec3 calculateViewVector(final float float1, final float float2) {
        final float float3 = float1 * 0.017453292f;
        final float float4 = -float2 * 0.017453292f;
        final float float5 = Mth.cos(float4);
        final float float6 = Mth.sin(float4);
        final float float7 = Mth.cos(float3);
        final float float8 = Mth.sin(float3);
        return new Vec3(float6 * float7, -float8, float5 * float7);
    }
    
    public final Vec3 getUpVector(final float float1) {
        return this.calculateUpVector(this.getViewXRot(float1), this.getViewYRot(float1));
    }
    
    protected final Vec3 calculateUpVector(final float float1, final float float2) {
        return this.calculateViewVector(float1 - 90.0f, float2);
    }
    
    public final Vec3 getEyePosition(final float float1) {
        if (float1 == 1.0f) {
            return new Vec3(this.getX(), this.getEyeY(), this.getZ());
        }
        final double double3 = Mth.lerp(float1, this.xo, this.getX());
        final double double4 = Mth.lerp(float1, this.yo, this.getY()) + this.getEyeHeight();
        final double double5 = Mth.lerp(float1, this.zo, this.getZ());
        return new Vec3(double3, double4, double5);
    }
    
    public HitResult pick(final double double1, final float float2, final boolean boolean3) {
        final Vec3 dem6 = this.getEyePosition(float2);
        final Vec3 dem7 = this.getViewVector(float2);
        final Vec3 dem8 = dem6.add(dem7.x * double1, dem7.y * double1, dem7.z * double1);
        return this.level.clip(new ClipContext(dem6, dem8, ClipContext.Block.OUTLINE, boolean3 ? ClipContext.Fluid.ANY : ClipContext.Fluid.NONE, this));
    }
    
    public boolean isPickable() {
        return false;
    }
    
    public boolean isPushable() {
        return false;
    }
    
    public void awardKillScore(final Entity aom, final int integer, final DamageSource anw) {
        if (aom instanceof ServerPlayer) {
            CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer)aom, this, anw);
        }
    }
    
    public boolean shouldRender(final double double1, final double double2, final double double3) {
        final double double4 = this.getX() - double1;
        final double double5 = this.getY() - double2;
        final double double6 = this.getZ() - double3;
        final double double7 = double4 * double4 + double5 * double5 + double6 * double6;
        return this.shouldRenderAtSqrDistance(double7);
    }
    
    public boolean shouldRenderAtSqrDistance(final double double1) {
        double double2 = this.getBoundingBox().getSize();
        if (Double.isNaN(double2)) {
            double2 = 1.0;
        }
        double2 *= 64.0 * Entity.viewScale;
        return double1 < double2 * double2;
    }
    
    public boolean saveAsPassenger(final CompoundTag le) {
        final String string3 = this.getEncodeId();
        if (this.removed || string3 == null) {
            return false;
        }
        le.putString("id", string3);
        this.saveWithoutId(le);
        return true;
    }
    
    public boolean save(final CompoundTag le) {
        return !this.isPassenger() && this.saveAsPassenger(le);
    }
    
    public CompoundTag saveWithoutId(final CompoundTag le) {
        try {
            if (this.vehicle != null) {
                le.put("Pos", this.newDoubleList(this.vehicle.getX(), this.vehicle.getY(), this.vehicle.getZ()));
            }
            else {
                le.put("Pos", this.newDoubleList(this.getX(), this.getY(), this.getZ()));
            }
            final Vec3 dem3 = this.getDeltaMovement();
            le.put("Motion", this.newDoubleList(dem3.x, dem3.y, dem3.z));
            le.put("Rotation", this.newFloatList(this.yRot, this.xRot));
            le.putFloat("FallDistance", this.fallDistance);
            le.putShort("Fire", (short)this.remainingFireTicks);
            le.putShort("Air", (short)this.getAirSupply());
            le.putBoolean("OnGround", this.onGround);
            le.putBoolean("Invulnerable", this.invulnerable);
            le.putInt("PortalCooldown", this.changingDimensionDelay);
            le.putUUID("UUID", this.getUUID());
            final Component mr4 = this.getCustomName();
            if (mr4 != null) {
                le.putString("CustomName", Component.Serializer.toJson(mr4));
            }
            if (this.isCustomNameVisible()) {
                le.putBoolean("CustomNameVisible", this.isCustomNameVisible());
            }
            if (this.isSilent()) {
                le.putBoolean("Silent", this.isSilent());
            }
            if (this.isNoGravity()) {
                le.putBoolean("NoGravity", this.isNoGravity());
            }
            if (this.glowing) {
                le.putBoolean("Glowing", this.glowing);
            }
            if (!this.tags.isEmpty()) {
                final ListTag lk5 = new ListTag();
                for (final String string7 : this.tags) {
                    ((AbstractList<StringTag>)lk5).add(StringTag.valueOf(string7));
                }
                le.put("Tags", lk5);
            }
            this.addAdditionalSaveData(le);
            if (this.isVehicle()) {
                final ListTag lk5 = new ListTag();
                for (final Entity aom7 : this.getPassengers()) {
                    final CompoundTag le2 = new CompoundTag();
                    if (aom7.saveAsPassenger(le2)) {
                        ((AbstractList<CompoundTag>)lk5).add(le2);
                    }
                }
                if (!lk5.isEmpty()) {
                    le.put("Passengers", lk5);
                }
            }
        }
        catch (Throwable throwable3) {
            final CrashReport j4 = CrashReport.forThrowable(throwable3, "Saving entity NBT");
            final CrashReportCategory k5 = j4.addCategory("Entity being saved");
            this.fillCrashReportCategory(k5);
            throw new ReportedException(j4);
        }
        return le;
    }
    
    public void load(final CompoundTag le) {
        try {
            final ListTag lk3 = le.getList("Pos", 6);
            final ListTag lk4 = le.getList("Motion", 6);
            final ListTag lk5 = le.getList("Rotation", 5);
            final double double6 = lk4.getDouble(0);
            final double double7 = lk4.getDouble(1);
            final double double8 = lk4.getDouble(2);
            this.setDeltaMovement((Math.abs(double6) > 10.0) ? 0.0 : double6, (Math.abs(double7) > 10.0) ? 0.0 : double7, (Math.abs(double8) > 10.0) ? 0.0 : double8);
            this.setPosAndOldPos(lk3.getDouble(0), lk3.getDouble(1), lk3.getDouble(2));
            this.yRot = lk5.getFloat(0);
            this.xRot = lk5.getFloat(1);
            this.yRotO = this.yRot;
            this.xRotO = this.xRot;
            this.setYHeadRot(this.yRot);
            this.setYBodyRot(this.yRot);
            this.fallDistance = le.getFloat("FallDistance");
            this.remainingFireTicks = le.getShort("Fire");
            this.setAirSupply(le.getShort("Air"));
            this.onGround = le.getBoolean("OnGround");
            this.invulnerable = le.getBoolean("Invulnerable");
            this.changingDimensionDelay = le.getInt("PortalCooldown");
            if (le.hasUUID("UUID")) {
                this.uuid = le.getUUID("UUID");
                this.stringUUID = this.uuid.toString();
            }
            if (!Double.isFinite(this.getX()) || !Double.isFinite(this.getY()) || !Double.isFinite(this.getZ())) {
                throw new IllegalStateException("Entity has invalid position");
            }
            if (!Double.isFinite(this.yRot) || !Double.isFinite(this.xRot)) {
                throw new IllegalStateException("Entity has invalid rotation");
            }
            this.reapplyPosition();
            this.setRot(this.yRot, this.xRot);
            if (le.contains("CustomName", 8)) {
                final String string12 = le.getString("CustomName");
                try {
                    this.setCustomName(Component.Serializer.fromJson(string12));
                }
                catch (Exception exception13) {
                    Entity.LOGGER.warn("Failed to parse entity custom name {}", string12, exception13);
                }
            }
            this.setCustomNameVisible(le.getBoolean("CustomNameVisible"));
            this.setSilent(le.getBoolean("Silent"));
            this.setNoGravity(le.getBoolean("NoGravity"));
            this.setGlowing(le.getBoolean("Glowing"));
            if (le.contains("Tags", 9)) {
                this.tags.clear();
                final ListTag lk6 = le.getList("Tags", 8);
                for (int integer13 = Math.min(lk6.size(), 1024), integer14 = 0; integer14 < integer13; ++integer14) {
                    this.tags.add(lk6.getString(integer14));
                }
            }
            this.readAdditionalSaveData(le);
            if (this.repositionEntityAfterLoad()) {
                this.reapplyPosition();
            }
        }
        catch (Throwable throwable3) {
            final CrashReport j4 = CrashReport.forThrowable(throwable3, "Loading entity NBT");
            final CrashReportCategory k5 = j4.addCategory("Entity being loaded");
            this.fillCrashReportCategory(k5);
            throw new ReportedException(j4);
        }
    }
    
    protected boolean repositionEntityAfterLoad() {
        return true;
    }
    
    @Nullable
    protected final String getEncodeId() {
        final EntityType<?> aoq2 = this.getType();
        final ResourceLocation uh3 = EntityType.getKey(aoq2);
        return (!aoq2.canSerialize() || uh3 == null) ? null : uh3.toString();
    }
    
    protected abstract void readAdditionalSaveData(final CompoundTag le);
    
    protected abstract void addAdditionalSaveData(final CompoundTag le);
    
    protected ListTag newDoubleList(final double... arr) {
        final ListTag lk3 = new ListTag();
        for (final double double7 : arr) {
            ((AbstractList<DoubleTag>)lk3).add(DoubleTag.valueOf(double7));
        }
        return lk3;
    }
    
    protected ListTag newFloatList(final float... arr) {
        final ListTag lk3 = new ListTag();
        for (final float float7 : arr) {
            ((AbstractList<FloatTag>)lk3).add(FloatTag.valueOf(float7));
        }
        return lk3;
    }
    
    @Nullable
    public ItemEntity spawnAtLocation(final ItemLike bqa) {
        return this.spawnAtLocation(bqa, 0);
    }
    
    @Nullable
    public ItemEntity spawnAtLocation(final ItemLike bqa, final int integer) {
        return this.spawnAtLocation(new ItemStack(bqa), (float)integer);
    }
    
    @Nullable
    public ItemEntity spawnAtLocation(final ItemStack bki) {
        return this.spawnAtLocation(bki, 0.0f);
    }
    
    @Nullable
    public ItemEntity spawnAtLocation(final ItemStack bki, final float float2) {
        if (bki.isEmpty()) {
            return null;
        }
        if (this.level.isClientSide) {
            return null;
        }
        final ItemEntity bbg4 = new ItemEntity(this.level, this.getX(), this.getY() + float2, this.getZ(), bki);
        bbg4.setDefaultPickUpDelay();
        this.level.addFreshEntity(bbg4);
        return bbg4;
    }
    
    public boolean isAlive() {
        return !this.removed;
    }
    
    public boolean isInWall() {
        if (this.noPhysics) {
            return false;
        }
        final float float2 = 0.1f;
        final float float3 = this.dimensions.width * 0.8f;
        final AABB deg4 = AABB.ofSize(float3, 0.10000000149011612, float3).move(this.getX(), this.getEyeY(), this.getZ());
        return this.level.getBlockCollisions(this, deg4, (cfj, fu) -> cfj.isSuffocating(this.level, fu)).findAny().isPresent();
    }
    
    public InteractionResult interact(final Player bec, final InteractionHand anf) {
        return InteractionResult.PASS;
    }
    
    @Nullable
    public AABB getCollideAgainstBox(final Entity aom) {
        return null;
    }
    
    public void rideTick() {
        this.setDeltaMovement(Vec3.ZERO);
        this.tick();
        if (!this.isPassenger()) {
            return;
        }
        this.getVehicle().positionRider(this);
    }
    
    public void positionRider(final Entity aom) {
        this.positionRider(aom, Entity::setPos);
    }
    
    private void positionRider(final Entity aom, final MoveFunction a) {
        if (!this.hasPassenger(aom)) {
            return;
        }
        final double double4 = this.getY() + this.getPassengersRidingOffset() + aom.getMyRidingOffset();
        a.accept(aom, this.getX(), double4, this.getZ());
    }
    
    public void onPassengerTurned(final Entity aom) {
    }
    
    public double getMyRidingOffset() {
        return 0.0;
    }
    
    public double getPassengersRidingOffset() {
        return this.dimensions.height * 0.75;
    }
    
    public boolean startRiding(final Entity aom) {
        return this.startRiding(aom, false);
    }
    
    public boolean showVehicleHealth() {
        return this instanceof LivingEntity;
    }
    
    public boolean startRiding(final Entity aom, final boolean boolean2) {
        for (Entity aom2 = aom; aom2.vehicle != null; aom2 = aom2.vehicle) {
            if (aom2.vehicle == this) {
                return false;
            }
        }
        if (!boolean2 && (!this.canRide(aom) || !aom.canAddPassenger(this))) {
            return false;
        }
        if (this.isPassenger()) {
            this.stopRiding();
        }
        this.setPose(Pose.STANDING);
        (this.vehicle = aom).addPassenger(this);
        return true;
    }
    
    protected boolean canRide(final Entity aom) {
        return !this.isShiftKeyDown() && this.boardingCooldown <= 0;
    }
    
    protected boolean canEnterPose(final Pose apj) {
        return this.level.noCollision(this, this.getBoundingBoxForPose(apj).deflate(1.0E-7));
    }
    
    public void ejectPassengers() {
        for (int integer2 = this.passengers.size() - 1; integer2 >= 0; --integer2) {
            this.passengers.get(integer2).stopRiding();
        }
    }
    
    public void removeVehicle() {
        if (this.vehicle != null) {
            final Entity aom2 = this.vehicle;
            this.vehicle = null;
            aom2.removePassenger(this);
        }
    }
    
    public void stopRiding() {
        this.removeVehicle();
    }
    
    protected void addPassenger(final Entity aom) {
        if (aom.getVehicle() != this) {
            throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
        }
        if (!this.level.isClientSide && aom instanceof Player && !(this.getControllingPassenger() instanceof Player)) {
            this.passengers.add(0, aom);
        }
        else {
            this.passengers.add(aom);
        }
    }
    
    protected void removePassenger(final Entity aom) {
        if (aom.getVehicle() == this) {
            throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
        }
        this.passengers.remove(aom);
        aom.boardingCooldown = 60;
    }
    
    protected boolean canAddPassenger(final Entity aom) {
        return this.getPassengers().size() < 1;
    }
    
    public void lerpTo(final double double1, final double double2, final double double3, final float float4, final float float5, final int integer, final boolean boolean7) {
        this.setPos(double1, double2, double3);
        this.setRot(float4, float5);
    }
    
    public void lerpHeadTo(final float float1, final int integer) {
        this.setYHeadRot(float1);
    }
    
    public float getPickRadius() {
        return 0.0f;
    }
    
    public Vec3 getLookAngle() {
        return this.calculateViewVector(this.xRot, this.yRot);
    }
    
    public Vec2 getRotationVector() {
        return new Vec2(this.xRot, this.yRot);
    }
    
    public Vec3 getForward() {
        return Vec3.directionFromRotation(this.getRotationVector());
    }
    
    public void handleInsidePortal(final BlockPos fu) {
        if (this.changingDimensionDelay > 0) {
            this.changingDimensionDelay = this.getDimensionChangingDelay();
            return;
        }
        if (!this.level.isClientSide && !fu.equals(this.portalEntranceBlock)) {
            this.portalEntranceBlock = new BlockPos(fu);
            final NetherPortalBlock netherPortalBlock = (NetherPortalBlock)Blocks.NETHER_PORTAL;
            final BlockPattern.BlockPatternMatch b3 = NetherPortalBlock.getPortalShape(this.level, this.portalEntranceBlock);
            final double double4 = (b3.getForwards().getAxis() == Direction.Axis.X) ? b3.getFrontTopLeft().getZ() : ((double)b3.getFrontTopLeft().getX());
            final double double5 = Mth.clamp(Math.abs(Mth.inverseLerp(((b3.getForwards().getAxis() == Direction.Axis.X) ? this.getZ() : this.getX()) - (double)((b3.getForwards().getClockWise().getAxisDirection() == Direction.AxisDirection.NEGATIVE) ? 1 : 0), double4, double4 - b3.getWidth())), 0.0, 1.0);
            final double double6 = Mth.clamp(Mth.inverseLerp(this.getY() - 1.0, b3.getFrontTopLeft().getY(), b3.getFrontTopLeft().getY() - b3.getHeight()), 0.0, 1.0);
            this.portalEntranceOffset = new Vec3(double5, double6, 0.0);
            this.portalEntranceForwards = b3.getForwards();
        }
        this.isInsidePortal = true;
    }
    
    protected void handleNetherPortal() {
        if (!(this.level instanceof ServerLevel)) {
            return;
        }
        final int integer2 = this.getPortalWaitTime();
        final ServerLevel zd3 = (ServerLevel)this.level;
        if (this.isInsidePortal) {
            final MinecraftServer minecraftServer4 = zd3.getServer();
            final ResourceKey<Level> ug5 = (this.level.dimension() == Level.NETHER) ? Level.OVERWORLD : Level.NETHER;
            final ServerLevel zd4 = minecraftServer4.getLevel(ug5);
            if (zd4 != null && minecraftServer4.isNetherEnabled() && !this.isPassenger() && this.portalTime++ >= integer2) {
                this.level.getProfiler().push("portal");
                this.portalTime = integer2;
                this.changingDimensionDelay = this.getDimensionChangingDelay();
                this.changeDimension(zd4);
                this.level.getProfiler().pop();
            }
            this.isInsidePortal = false;
        }
        else {
            if (this.portalTime > 0) {
                this.portalTime -= 4;
            }
            if (this.portalTime < 0) {
                this.portalTime = 0;
            }
        }
        this.processDimensionDelay();
    }
    
    public int getDimensionChangingDelay() {
        return 300;
    }
    
    public void lerpMotion(final double double1, final double double2, final double double3) {
        this.setDeltaMovement(double1, double2, double3);
    }
    
    public void handleEntityEvent(final byte byte1) {
        switch (byte1) {
            case 53: {
                HoneyBlock.showSlideParticles(this);
                break;
            }
        }
    }
    
    public void animateHurt() {
    }
    
    public Iterable<ItemStack> getHandSlots() {
        return Entity.EMPTY_LIST;
    }
    
    public Iterable<ItemStack> getArmorSlots() {
        return Entity.EMPTY_LIST;
    }
    
    public Iterable<ItemStack> getAllSlots() {
        return Iterables.<ItemStack>concat(this.getHandSlots(), this.getArmorSlots());
    }
    
    public void setItemSlot(final EquipmentSlot aor, final ItemStack bki) {
    }
    
    public boolean isOnFire() {
        final boolean boolean2 = this.level != null && this.level.isClientSide;
        return !this.fireImmune() && (this.remainingFireTicks > 0 || (boolean2 && this.getSharedFlag(0)));
    }
    
    public boolean isPassenger() {
        return this.getVehicle() != null;
    }
    
    public boolean isVehicle() {
        return !this.getPassengers().isEmpty();
    }
    
    public boolean rideableUnderWater() {
        return true;
    }
    
    public void setShiftKeyDown(final boolean boolean1) {
        this.setSharedFlag(1, boolean1);
    }
    
    public boolean isShiftKeyDown() {
        return this.getSharedFlag(1);
    }
    
    public boolean isSteppingCarefully() {
        return this.isShiftKeyDown();
    }
    
    public boolean isSuppressingBounce() {
        return this.isShiftKeyDown();
    }
    
    public boolean isDiscrete() {
        return this.isShiftKeyDown();
    }
    
    public boolean isDescending() {
        return this.isShiftKeyDown();
    }
    
    public boolean isCrouching() {
        return this.getPose() == Pose.CROUCHING;
    }
    
    public boolean isSprinting() {
        return this.getSharedFlag(3);
    }
    
    public void setSprinting(final boolean boolean1) {
        this.setSharedFlag(3, boolean1);
    }
    
    public boolean isSwimming() {
        return this.getSharedFlag(4);
    }
    
    public boolean isVisuallySwimming() {
        return this.getPose() == Pose.SWIMMING;
    }
    
    public boolean isVisuallyCrawling() {
        return this.isVisuallySwimming() && !this.isInWater();
    }
    
    public void setSwimming(final boolean boolean1) {
        this.setSharedFlag(4, boolean1);
    }
    
    public boolean isGlowing() {
        return this.glowing || (this.level.isClientSide && this.getSharedFlag(6));
    }
    
    public void setGlowing(final boolean boolean1) {
        this.glowing = boolean1;
        if (!this.level.isClientSide) {
            this.setSharedFlag(6, this.glowing);
        }
    }
    
    public boolean isInvisible() {
        return this.getSharedFlag(5);
    }
    
    public boolean isInvisibleTo(final Player bec) {
        if (bec.isSpectator()) {
            return false;
        }
        final Team dfo3 = this.getTeam();
        return (dfo3 == null || bec == null || bec.getTeam() != dfo3 || !dfo3.canSeeFriendlyInvisibles()) && this.isInvisible();
    }
    
    @Nullable
    public Team getTeam() {
        return this.level.getScoreboard().getPlayersTeam(this.getScoreboardName());
    }
    
    public boolean isAlliedTo(final Entity aom) {
        return this.isAlliedTo(aom.getTeam());
    }
    
    public boolean isAlliedTo(final Team dfo) {
        return this.getTeam() != null && this.getTeam().isAlliedTo(dfo);
    }
    
    public void setInvisible(final boolean boolean1) {
        this.setSharedFlag(5, boolean1);
    }
    
    protected boolean getSharedFlag(final int integer) {
        return (this.entityData.<Byte>get(Entity.DATA_SHARED_FLAGS_ID) & 1 << integer) != 0x0;
    }
    
    protected void setSharedFlag(final int integer, final boolean boolean2) {
        final byte byte4 = this.entityData.<Byte>get(Entity.DATA_SHARED_FLAGS_ID);
        if (boolean2) {
            this.entityData.<Byte>set(Entity.DATA_SHARED_FLAGS_ID, (byte)(byte4 | 1 << integer));
        }
        else {
            this.entityData.<Byte>set(Entity.DATA_SHARED_FLAGS_ID, (byte)(byte4 & ~(1 << integer)));
        }
    }
    
    public int getMaxAirSupply() {
        return 300;
    }
    
    public int getAirSupply() {
        return this.entityData.<Integer>get(Entity.DATA_AIR_SUPPLY_ID);
    }
    
    public void setAirSupply(final int integer) {
        this.entityData.<Integer>set(Entity.DATA_AIR_SUPPLY_ID, integer);
    }
    
    public void thunderHit(final LightningBolt aox) {
        this.setRemainingFireTicks(this.remainingFireTicks + 1);
        if (this.remainingFireTicks == 0) {
            this.setSecondsOnFire(8);
        }
        this.hurt(DamageSource.LIGHTNING_BOLT, 5.0f);
    }
    
    public void onAboveBubbleCol(final boolean boolean1) {
        final Vec3 dem3 = this.getDeltaMovement();
        double double4;
        if (boolean1) {
            double4 = Math.max(-0.9, dem3.y - 0.03);
        }
        else {
            double4 = Math.min(1.8, dem3.y + 0.1);
        }
        this.setDeltaMovement(dem3.x, double4, dem3.z);
    }
    
    public void onInsideBubbleColumn(final boolean boolean1) {
        final Vec3 dem3 = this.getDeltaMovement();
        double double4;
        if (boolean1) {
            double4 = Math.max(-0.3, dem3.y - 0.03);
        }
        else {
            double4 = Math.min(0.7, dem3.y + 0.06);
        }
        this.setDeltaMovement(dem3.x, double4, dem3.z);
        this.fallDistance = 0.0f;
    }
    
    public void killed(final LivingEntity aoy) {
    }
    
    protected void checkInBlock(final double double1, final double double2, final double double3) {
        final BlockPos fu8 = new BlockPos(double1, double2, double3);
        final Vec3 dem9 = new Vec3(double1 - fu8.getX(), double2 - fu8.getY(), double3 - fu8.getZ());
        final BlockPos.MutableBlockPos a10 = new BlockPos.MutableBlockPos();
        Direction fz11 = Direction.UP;
        double double4 = Double.MAX_VALUE;
        for (final Direction fz12 : new Direction[] { Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST, Direction.UP }) {
            a10.setWithOffset(fu8, fz12);
            if (!this.level.getBlockState(a10).isCollisionShapeFullBlock(this.level, a10)) {
                final double double5 = dem9.get(fz12.getAxis());
                final double double6 = (fz12.getAxisDirection() == Direction.AxisDirection.POSITIVE) ? (1.0 - double5) : double5;
                if (double6 < double4) {
                    double4 = double6;
                    fz11 = fz12;
                }
            }
        }
        final float float14 = this.random.nextFloat() * 0.2f + 0.1f;
        final float float15 = (float)fz11.getAxisDirection().getStep();
        final Vec3 dem10 = this.getDeltaMovement().scale(0.75);
        if (fz11.getAxis() == Direction.Axis.X) {
            this.setDeltaMovement(float15 * float14, dem10.y, dem10.z);
        }
        else if (fz11.getAxis() == Direction.Axis.Y) {
            this.setDeltaMovement(dem10.x, float15 * float14, dem10.z);
        }
        else if (fz11.getAxis() == Direction.Axis.Z) {
            this.setDeltaMovement(dem10.x, dem10.y, float15 * float14);
        }
    }
    
    public void makeStuckInBlock(final BlockState cfj, final Vec3 dem) {
        this.fallDistance = 0.0f;
        this.stuckSpeedMultiplier = dem;
    }
    
    private static Component removeAction(final Component mr) {
        final MutableComponent mx2 = mr.plainCopy().setStyle(mr.getStyle().withClickEvent(null));
        for (final Component mr2 : mr.getSiblings()) {
            mx2.append(removeAction(mr2));
        }
        return mx2;
    }
    
    @Override
    public Component getName() {
        final Component mr2 = this.getCustomName();
        if (mr2 != null) {
            return removeAction(mr2);
        }
        return this.getTypeName();
    }
    
    protected Component getTypeName() {
        return this.type.getDescription();
    }
    
    public boolean is(final Entity aom) {
        return this == aom;
    }
    
    public float getYHeadRot() {
        return 0.0f;
    }
    
    public void setYHeadRot(final float float1) {
    }
    
    public void setYBodyRot(final float float1) {
    }
    
    public boolean isAttackable() {
        return true;
    }
    
    public boolean skipAttackInteraction(final Entity aom) {
        return false;
    }
    
    @Override
    public String toString() {
        return String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getName().getString(), this.id, (this.level == null) ? "~NULL~" : this.level.toString(), this.getX(), this.getY(), this.getZ());
    }
    
    public boolean isInvulnerableTo(final DamageSource anw) {
        return this.invulnerable && anw != DamageSource.OUT_OF_WORLD && !anw.isCreativePlayer();
    }
    
    public boolean isInvulnerable() {
        return this.invulnerable;
    }
    
    public void setInvulnerable(final boolean boolean1) {
        this.invulnerable = boolean1;
    }
    
    public void copyPosition(final Entity aom) {
        this.moveTo(aom.getX(), aom.getY(), aom.getZ(), aom.yRot, aom.xRot);
    }
    
    public void restoreFrom(final Entity aom) {
        final CompoundTag le3 = aom.saveWithoutId(new CompoundTag());
        le3.remove("Dimension");
        this.load(le3);
        this.changingDimensionDelay = aom.changingDimensionDelay;
        this.portalEntranceBlock = aom.portalEntranceBlock;
        this.portalEntranceOffset = aom.portalEntranceOffset;
        this.portalEntranceForwards = aom.portalEntranceForwards;
    }
    
    @Nullable
    public Entity changeDimension(final ServerLevel zd) {
        if (!(this.level instanceof ServerLevel) || this.removed) {
            return null;
        }
        this.level.getProfiler().push("changeDimension");
        this.unRide();
        this.level.getProfiler().push("reposition");
        Vec3 dem4 = this.getDeltaMovement();
        float float5 = 0.0f;
        BlockPos fu3;
        if (this.level.dimension() == Level.END && zd.dimension() == Level.OVERWORLD) {
            fu3 = zd.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, zd.getSharedSpawnPos());
        }
        else if (zd.dimension() == Level.END) {
            fu3 = ServerLevel.END_SPAWN_POINT;
        }
        else {
            double double6 = this.getX();
            double double7 = this.getZ();
            final DimensionType cif10 = this.level.dimensionType();
            final DimensionType cif11 = zd.dimensionType();
            final double double8 = 8.0;
            if (!cif10.shrunk() && cif11.shrunk()) {
                double6 /= 8.0;
                double7 /= 8.0;
            }
            else if (cif10.shrunk() && !cif11.shrunk()) {
                double6 *= 8.0;
                double7 *= 8.0;
            }
            final double double9 = Math.min(-2.9999872E7, zd.getWorldBorder().getMinX() + 16.0);
            final double double10 = Math.min(-2.9999872E7, zd.getWorldBorder().getMinZ() + 16.0);
            final double double11 = Math.min(2.9999872E7, zd.getWorldBorder().getMaxX() - 16.0);
            final double double12 = Math.min(2.9999872E7, zd.getWorldBorder().getMaxZ() - 16.0);
            double6 = Mth.clamp(double6, double9, double11);
            double7 = Mth.clamp(double7, double10, double12);
            final Vec3 dem5 = this.getPortalEntranceOffset();
            fu3 = new BlockPos(double6, this.getY(), double7);
            final BlockPattern.PortalInfo c23 = zd.getPortalForcer().findPortal(fu3, dem4, this.getPortalEntranceForwards(), dem5.x, dem5.y, this instanceof Player);
            if (c23 == null) {
                return null;
            }
            fu3 = new BlockPos(c23.pos);
            dem4 = c23.speed;
            float5 = (float)c23.angle;
        }
        this.level.getProfiler().popPush("reloading");
        final Entity aom6 = (Entity)this.getType().create(zd);
        if (aom6 != null) {
            aom6.restoreFrom(this);
            aom6.moveTo(fu3, aom6.yRot + float5, aom6.xRot);
            aom6.setDeltaMovement(dem4);
            zd.addFromAnotherDimension(aom6);
            if (zd.dimension() == Level.END) {
                ServerLevel.makeObsidianPlatform(zd);
            }
        }
        this.removeAfterChangingDimensions();
        this.level.getProfiler().pop();
        ((ServerLevel)this.level).resetEmptyTime();
        zd.resetEmptyTime();
        this.level.getProfiler().pop();
        return aom6;
    }
    
    protected void removeAfterChangingDimensions() {
        this.removed = true;
    }
    
    public boolean canChangeDimensions() {
        return true;
    }
    
    public float getBlockExplosionResistance(final Explosion bpt, final BlockGetter bpg, final BlockPos fu, final BlockState cfj, final FluidState cxa, final float float6) {
        return float6;
    }
    
    public boolean shouldBlockExplode(final Explosion bpt, final BlockGetter bpg, final BlockPos fu, final BlockState cfj, final float float5) {
        return true;
    }
    
    public int getMaxFallDistance() {
        return 3;
    }
    
    public Vec3 getPortalEntranceOffset() {
        return this.portalEntranceOffset;
    }
    
    public Direction getPortalEntranceForwards() {
        return this.portalEntranceForwards;
    }
    
    public boolean isIgnoringBlockTriggers() {
        return false;
    }
    
    public void fillCrashReportCategory(final CrashReportCategory k) {
        k.setDetail("Entity Type", () -> EntityType.getKey(this.getType()) + " (" + this.getClass().getCanonicalName() + ")");
        k.setDetail("Entity ID", this.id);
        k.setDetail("Entity Name", () -> this.getName().getString());
        k.setDetail("Entity's Exact location", String.format(Locale.ROOT, "%.2f, %.2f, %.2f", this.getX(), this.getY(), this.getZ()));
        k.setDetail("Entity's Block location", CrashReportCategory.formatLocation(Mth.floor(this.getX()), Mth.floor(this.getY()), Mth.floor(this.getZ())));
        final Vec3 dem3 = this.getDeltaMovement();
        k.setDetail("Entity's Momentum", String.format(Locale.ROOT, "%.2f, %.2f, %.2f", dem3.x, dem3.y, dem3.z));
        k.setDetail("Entity's Passengers", () -> this.getPassengers().toString());
        k.setDetail("Entity's Vehicle", () -> this.getVehicle().toString());
    }
    
    public boolean displayFireAnimation() {
        return this.isOnFire() && !this.isSpectator();
    }
    
    public void setUUID(final UUID uUID) {
        this.uuid = uUID;
        this.stringUUID = this.uuid.toString();
    }
    
    public UUID getUUID() {
        return this.uuid;
    }
    
    public String getStringUUID() {
        return this.stringUUID;
    }
    
    public String getScoreboardName() {
        return this.stringUUID;
    }
    
    public boolean isPushedByFluid() {
        return true;
    }
    
    public static double getViewScale() {
        return Entity.viewScale;
    }
    
    public static void setViewScale(final double double1) {
        Entity.viewScale = double1;
    }
    
    @Override
    public Component getDisplayName() {
        return PlayerTeam.formatNameForTeam(this.getTeam(), this.getName()).withStyle(nb -> nb.withHoverEvent(this.createHoverEvent()).withInsertion(this.getStringUUID()));
    }
    
    public void setCustomName(@Nullable final Component mr) {
        this.entityData.<Optional<Component>>set(Entity.DATA_CUSTOM_NAME, Optional.<Component>ofNullable(mr));
    }
    
    @Nullable
    @Override
    public Component getCustomName() {
        return this.entityData.<Optional<Component>>get(Entity.DATA_CUSTOM_NAME).orElse(null);
    }
    
    @Override
    public boolean hasCustomName() {
        return this.entityData.<Optional<Component>>get(Entity.DATA_CUSTOM_NAME).isPresent();
    }
    
    public void setCustomNameVisible(final boolean boolean1) {
        this.entityData.<Boolean>set(Entity.DATA_CUSTOM_NAME_VISIBLE, boolean1);
    }
    
    public boolean isCustomNameVisible() {
        return this.entityData.<Boolean>get(Entity.DATA_CUSTOM_NAME_VISIBLE);
    }
    
    public final void teleportToWithTicket(final double double1, final double double2, final double double3) {
        if (!(this.level instanceof ServerLevel)) {
            return;
        }
        final ChunkPos bph8 = new ChunkPos(new BlockPos(double1, double2, double3));
        ((ServerLevel)this.level).getChunkSource().<Integer>addRegionTicket(TicketType.POST_TELEPORT, bph8, 0, this.getId());
        this.level.getChunk(bph8.x, bph8.z);
        this.teleportTo(double1, double2, double3);
    }
    
    public void teleportTo(final double double1, final double double2, final double double3) {
        if (!(this.level instanceof ServerLevel)) {
            return;
        }
        final ServerLevel zd8 = (ServerLevel)this.level;
        this.moveTo(double1, double2, double3, this.yRot, this.xRot);
        final Iterator<Entity> iterator;
        Entity aom2;
        this.getSelfAndPassengers().forEach(aom -> {
            zd8.updateChunkPos(aom);
            aom.forceChunkAddition = true;
            aom.passengers.iterator();
            while (iterator.hasNext()) {
                aom2 = iterator.next();
                aom.positionRider(aom2, Entity::moveTo);
            }
        });
    }
    
    public boolean shouldShowName() {
        return this.isCustomNameVisible();
    }
    
    public void onSyncedDataUpdated(final EntityDataAccessor<?> tq) {
        if (Entity.DATA_POSE.equals(tq)) {
            this.refreshDimensions();
        }
    }
    
    public void refreshDimensions() {
        final EntityDimensions aon2 = this.dimensions;
        final Pose apj3 = this.getPose();
        final EntityDimensions aon3 = this.getDimensions(apj3);
        this.dimensions = aon3;
        this.eyeHeight = this.getEyeHeight(apj3, aon3);
        if (aon3.width < aon2.width) {
            final double double5 = aon3.width / 2.0;
            this.setBoundingBox(new AABB(this.getX() - double5, this.getY(), this.getZ() - double5, this.getX() + double5, this.getY() + aon3.height, this.getZ() + double5));
            return;
        }
        final AABB deg5 = this.getBoundingBox();
        this.setBoundingBox(new AABB(deg5.minX, deg5.minY, deg5.minZ, deg5.minX + aon3.width, deg5.minY + aon3.height, deg5.minZ + aon3.width));
        if (aon3.width > aon2.width && !this.firstTick && !this.level.isClientSide) {
            final float float6 = aon2.width - aon3.width;
            this.move(MoverType.SELF, new Vec3(float6, 0.0, float6));
        }
    }
    
    public Direction getDirection() {
        return Direction.fromYRot(this.yRot);
    }
    
    public Direction getMotionDirection() {
        return this.getDirection();
    }
    
    protected HoverEvent createHoverEvent() {
        return new HoverEvent((HoverEvent.Action<T>)HoverEvent.Action.SHOW_ENTITY, (T)new HoverEvent.EntityTooltipInfo(this.getType(), this.getUUID(), this.getName()));
    }
    
    public boolean broadcastToPlayer(final ServerPlayer ze) {
        return true;
    }
    
    public AABB getBoundingBox() {
        return this.bb;
    }
    
    public AABB getBoundingBoxForCulling() {
        return this.getBoundingBox();
    }
    
    protected AABB getBoundingBoxForPose(final Pose apj) {
        final EntityDimensions aon3 = this.getDimensions(apj);
        final float float4 = aon3.width / 2.0f;
        final Vec3 dem5 = new Vec3(this.getX() - float4, this.getY(), this.getZ() - float4);
        final Vec3 dem6 = new Vec3(this.getX() + float4, this.getY() + aon3.height, this.getZ() + float4);
        return new AABB(dem5, dem6);
    }
    
    public void setBoundingBox(final AABB deg) {
        this.bb = deg;
    }
    
    protected float getEyeHeight(final Pose apj, final EntityDimensions aon) {
        return aon.height * 0.85f;
    }
    
    public float getEyeHeight(final Pose apj) {
        return this.getEyeHeight(apj, this.getDimensions(apj));
    }
    
    public final float getEyeHeight() {
        return this.eyeHeight;
    }
    
    public Vec3 getLeashOffset() {
        return new Vec3(0.0, this.getEyeHeight(), this.getBbWidth() * 0.4f);
    }
    
    public boolean setSlot(final int integer, final ItemStack bki) {
        return false;
    }
    
    @Override
    public void sendMessage(final Component mr, final UUID uUID) {
    }
    
    public Level getCommandSenderWorld() {
        return this.level;
    }
    
    @Nullable
    public MinecraftServer getServer() {
        return this.level.getServer();
    }
    
    public InteractionResult interactAt(final Player bec, final Vec3 dem, final InteractionHand anf) {
        return InteractionResult.PASS;
    }
    
    public boolean ignoreExplosion() {
        return false;
    }
    
    public void doEnchantDamageEffects(final LivingEntity aoy, final Entity aom) {
        if (aom instanceof LivingEntity) {
            EnchantmentHelper.doPostHurtEffects((LivingEntity)aom, aoy);
        }
        EnchantmentHelper.doPostDamageEffects(aoy, aom);
    }
    
    public void startSeenByPlayer(final ServerPlayer ze) {
    }
    
    public void stopSeenByPlayer(final ServerPlayer ze) {
    }
    
    public float rotate(final Rotation cap) {
        final float float3 = Mth.wrapDegrees(this.yRot);
        switch (cap) {
            case CLOCKWISE_180: {
                return float3 + 180.0f;
            }
            case COUNTERCLOCKWISE_90: {
                return float3 + 270.0f;
            }
            case CLOCKWISE_90: {
                return float3 + 90.0f;
            }
            default: {
                return float3;
            }
        }
    }
    
    public float mirror(final Mirror bzj) {
        final float float3 = Mth.wrapDegrees(this.yRot);
        switch (bzj) {
            case LEFT_RIGHT: {
                return -float3;
            }
            case FRONT_BACK: {
                return 180.0f - float3;
            }
            default: {
                return float3;
            }
        }
    }
    
    public boolean onlyOpCanSetNbt() {
        return false;
    }
    
    public boolean checkAndResetForcedChunkAdditionFlag() {
        final boolean boolean2 = this.forceChunkAddition;
        this.forceChunkAddition = false;
        return boolean2;
    }
    
    public boolean checkAndResetUpdateChunkPos() {
        final boolean boolean2 = this.movedSinceLastChunkCheck;
        this.movedSinceLastChunkCheck = false;
        return boolean2;
    }
    
    @Nullable
    public Entity getControllingPassenger() {
        return null;
    }
    
    public List<Entity> getPassengers() {
        if (this.passengers.isEmpty()) {
            return Collections.<Entity>emptyList();
        }
        return Lists.newArrayList(this.passengers);
    }
    
    public boolean hasPassenger(final Entity aom) {
        for (final Entity aom2 : this.getPassengers()) {
            if (aom2.equals(aom)) {
                return true;
            }
        }
        return false;
    }
    
    public boolean hasPassenger(final Class<? extends Entity> class1) {
        for (final Entity aom4 : this.getPassengers()) {
            if (class1.isAssignableFrom(aom4.getClass())) {
                return true;
            }
        }
        return false;
    }
    
    public Collection<Entity> getIndirectPassengers() {
        final Set<Entity> set2 = Sets.newHashSet();
        for (final Entity aom4 : this.getPassengers()) {
            set2.add(aom4);
            aom4.fillIndirectPassengers(false, set2);
        }
        return set2;
    }
    
    public Stream<Entity> getSelfAndPassengers() {
        return Stream.<Entity>concat(Stream.of((T)this), this.passengers.stream().flatMap(Entity::getSelfAndPassengers));
    }
    
    public boolean hasOnePlayerPassenger() {
        final Set<Entity> set2 = Sets.newHashSet();
        this.fillIndirectPassengers(true, set2);
        return set2.size() == 1;
    }
    
    private void fillIndirectPassengers(final boolean boolean1, final Set<Entity> set) {
        for (final Entity aom5 : this.getPassengers()) {
            if (!boolean1 || ServerPlayer.class.isAssignableFrom(aom5.getClass())) {
                set.add(aom5);
            }
            aom5.fillIndirectPassengers(boolean1, set);
        }
    }
    
    public Entity getRootVehicle() {
        Entity aom2;
        for (aom2 = this; aom2.isPassenger(); aom2 = aom2.getVehicle()) {}
        return aom2;
    }
    
    public boolean isPassengerOfSameVehicle(final Entity aom) {
        return this.getRootVehicle() == aom.getRootVehicle();
    }
    
    public boolean hasIndirectPassenger(final Entity aom) {
        for (final Entity aom2 : this.getPassengers()) {
            if (aom2.equals(aom)) {
                return true;
            }
            if (aom2.hasIndirectPassenger(aom)) {
                return true;
            }
        }
        return false;
    }
    
    public boolean isControlledByLocalInstance() {
        final Entity aom2 = this.getControllingPassenger();
        if (aom2 instanceof Player) {
            return ((Player)aom2).isLocalPlayer();
        }
        return !this.level.isClientSide;
    }
    
    protected static Vec3 getCollisionHorizontalEscapeVector(final double double1, final double double2, final float float3) {
        final double double3 = (double1 + double2 + 9.999999747378752E-6) / 2.0;
        final float float4 = -Mth.sin(float3 * 0.017453292f);
        final float float5 = Mth.cos(float3 * 0.017453292f);
        final float float6 = Math.max(Math.abs(float4), Math.abs(float5));
        return new Vec3(float4 * double3 / float6, 0.0, float5 * double3 / float6);
    }
    
    public Vec3 getDismountLocationForPassenger(final LivingEntity aoy) {
        return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
    }
    
    @Nullable
    public Entity getVehicle() {
        return this.vehicle;
    }
    
    public PushReaction getPistonPushReaction() {
        return PushReaction.NORMAL;
    }
    
    public SoundSource getSoundSource() {
        return SoundSource.NEUTRAL;
    }
    
    protected int getFireImmuneTicks() {
        return 1;
    }
    
    public CommandSourceStack createCommandSourceStack() {
        return new CommandSourceStack(this, this.position(), this.getRotationVector(), (this.level instanceof ServerLevel) ? ((ServerLevel)this.level) : null, this.getPermissionLevel(), this.getName().getString(), this.getDisplayName(), this.level.getServer(), this);
    }
    
    protected int getPermissionLevel() {
        return 0;
    }
    
    public boolean hasPermissions(final int integer) {
        return this.getPermissionLevel() >= integer;
    }
    
    @Override
    public boolean acceptsSuccess() {
        return this.level.getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK);
    }
    
    @Override
    public boolean acceptsFailure() {
        return true;
    }
    
    @Override
    public boolean shouldInformAdmins() {
        return true;
    }
    
    public void lookAt(final EntityAnchorArgument.Anchor a, final Vec3 dem) {
        final Vec3 dem2 = a.apply(this);
        final double double5 = dem.x - dem2.x;
        final double double6 = dem.y - dem2.y;
        final double double7 = dem.z - dem2.z;
        final double double8 = Mth.sqrt(double5 * double5 + double7 * double7);
        this.xRot = Mth.wrapDegrees((float)(-(Mth.atan2(double6, double8) * 57.2957763671875)));
        this.setYHeadRot(this.yRot = Mth.wrapDegrees((float)(Mth.atan2(double7, double5) * 57.2957763671875) - 90.0f));
        this.xRotO = this.xRot;
        this.yRotO = this.yRot;
    }
    
    public boolean updateFluidHeightAndDoFluidPushing(final Tag<Fluid> adf, final double double2) {
        final AABB deg5 = this.getBoundingBox().deflate(0.001);
        final int integer6 = Mth.floor(deg5.minX);
        final int integer7 = Mth.ceil(deg5.maxX);
        final int integer8 = Mth.floor(deg5.minY);
        final int integer9 = Mth.ceil(deg5.maxY);
        final int integer10 = Mth.floor(deg5.minZ);
        final int integer11 = Mth.ceil(deg5.maxZ);
        if (!this.level.hasChunksAt(integer6, integer8, integer10, integer7, integer9, integer11)) {
            return false;
        }
        double double3 = 0.0;
        final boolean boolean14 = this.isPushedByFluid();
        boolean boolean15 = false;
        Vec3 dem16 = Vec3.ZERO;
        int integer12 = 0;
        final BlockPos.MutableBlockPos a18 = new BlockPos.MutableBlockPos();
        for (int integer13 = integer6; integer13 < integer7; ++integer13) {
            for (int integer14 = integer8; integer14 < integer9; ++integer14) {
                for (int integer15 = integer10; integer15 < integer11; ++integer15) {
                    a18.set(integer13, integer14, integer15);
                    final FluidState cxa22 = this.level.getFluidState(a18);
                    if (cxa22.is(adf)) {
                        final double double4 = integer14 + cxa22.getHeight(this.level, a18);
                        if (double4 >= deg5.minY) {
                            boolean15 = true;
                            double3 = Math.max(double4 - deg5.minY, double3);
                            if (boolean14) {
                                Vec3 dem17 = cxa22.getFlow(this.level, a18);
                                if (double3 < 0.4) {
                                    dem17 = dem17.scale(double3);
                                }
                                dem16 = dem16.add(dem17);
                                ++integer12;
                            }
                        }
                    }
                }
            }
        }
        if (dem16.length() > 0.0) {
            if (integer12 > 0) {
                dem16 = dem16.scale(1.0 / integer12);
            }
            if (!(this instanceof Player)) {
                dem16 = dem16.normalize();
            }
            final Vec3 dem18 = this.getDeltaMovement();
            dem16 = dem16.scale(double2 * 1.0);
            final double double5 = 0.003;
            if (Math.abs(dem18.x) < 0.003 && Math.abs(dem18.z) < 0.003 && dem16.length() < 0.0045000000000000005) {
                dem16 = dem16.normalize().scale(0.0045000000000000005);
            }
            this.setDeltaMovement(this.getDeltaMovement().add(dem16));
        }
        this.fluidHeight.put(adf, double3);
        return boolean15;
    }
    
    public double getFluidHeight(final Tag<Fluid> adf) {
        return this.fluidHeight.getDouble(adf);
    }
    
    public double getFluidJumpThreshold() {
        return (this.getEyeHeight() < 0.4) ? 0.0 : 0.4;
    }
    
    public final float getBbWidth() {
        return this.dimensions.width;
    }
    
    public final float getBbHeight() {
        return this.dimensions.height;
    }
    
    public abstract Packet<?> getAddEntityPacket();
    
    public EntityDimensions getDimensions(final Pose apj) {
        return this.type.getDimensions();
    }
    
    public Vec3 position() {
        return this.position;
    }
    
    public BlockPos blockPosition() {
        return this.blockPosition;
    }
    
    public Vec3 getDeltaMovement() {
        return this.deltaMovement;
    }
    
    public void setDeltaMovement(final Vec3 dem) {
        this.deltaMovement = dem;
    }
    
    public void setDeltaMovement(final double double1, final double double2, final double double3) {
        this.setDeltaMovement(new Vec3(double1, double2, double3));
    }
    
    public final double getX() {
        return this.position.x;
    }
    
    public double getX(final double double1) {
        return this.position.x + this.getBbWidth() * double1;
    }
    
    public double getRandomX(final double double1) {
        return this.getX((2.0 * this.random.nextDouble() - 1.0) * double1);
    }
    
    public final double getY() {
        return this.position.y;
    }
    
    public double getY(final double double1) {
        return this.position.y + this.getBbHeight() * double1;
    }
    
    public double getRandomY() {
        return this.getY(this.random.nextDouble());
    }
    
    public double getEyeY() {
        return this.position.y + this.eyeHeight;
    }
    
    public final double getZ() {
        return this.position.z;
    }
    
    public double getZ(final double double1) {
        return this.position.z + this.getBbWidth() * double1;
    }
    
    public double getRandomZ(final double double1) {
        return this.getZ((2.0 * this.random.nextDouble() - 1.0) * double1);
    }
    
    public void setPosRaw(final double double1, final double double2, final double double3) {
        if (this.position.x != double1 || this.position.y != double2 || this.position.z != double3) {
            this.position = new Vec3(double1, double2, double3);
            final int integer8 = Mth.floor(double1);
            final int integer9 = Mth.floor(double2);
            final int integer10 = Mth.floor(double3);
            if (integer8 != this.blockPosition.getX() || integer9 != this.blockPosition.getY() || integer10 != this.blockPosition.getZ()) {
                this.blockPosition = new BlockPos(integer8, integer9, integer10);
            }
            this.movedSinceLastChunkCheck = true;
        }
    }
    
    public void checkDespawn() {
    }
    
    static {
        LOGGER = LogManager.getLogger();
        ENTITY_COUNTER = new AtomicInteger();
        EMPTY_LIST = Collections.<ItemStack>emptyList();
        INITIAL_AABB = new AABB(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        Entity.viewScale = 1.0;
        DATA_SHARED_FLAGS_ID = SynchedEntityData.<Byte>defineId(Entity.class, EntityDataSerializers.BYTE);
        DATA_AIR_SUPPLY_ID = SynchedEntityData.<Integer>defineId(Entity.class, EntityDataSerializers.INT);
        DATA_CUSTOM_NAME = SynchedEntityData.<Optional<Component>>defineId(Entity.class, EntityDataSerializers.OPTIONAL_COMPONENT);
        DATA_CUSTOM_NAME_VISIBLE = SynchedEntityData.<Boolean>defineId(Entity.class, EntityDataSerializers.BOOLEAN);
        DATA_SILENT = SynchedEntityData.<Boolean>defineId(Entity.class, EntityDataSerializers.BOOLEAN);
        DATA_NO_GRAVITY = SynchedEntityData.<Boolean>defineId(Entity.class, EntityDataSerializers.BOOLEAN);
        DATA_POSE = SynchedEntityData.<Pose>defineId(Entity.class, EntityDataSerializers.POSE);
    }
    
    @FunctionalInterface
    public interface MoveFunction {
        void accept(final Entity aom, final double double2, final double double3, final double double4);
    }
}
