--- a/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/net/minecraft/world/entity/animal/camel/Camel.java
@@ -51,6 +51,7 @@
 import net.minecraft.world.phys.Vec3;
 
 public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddleable {
+
     public static final float BABY_SCALE = 0.45F;
     public static final int DASH_COOLDOWN_TICKS = 55;
     public static final int MAX_HEAD_Y_ROT = 30;
@@ -69,8 +70,7 @@
     public final AnimationState sitUpAnimationState = new AnimationState();
     public final AnimationState idleAnimationState = new AnimationState();
     public final AnimationState dashAnimationState = new AnimationState();
-    private static final EntityDimensions SITTING_DIMENSIONS = EntityDimensions.scalable(EntityType.CAMEL.getWidth(), EntityType.CAMEL.getHeight() - 1.43F)
-        .withEyeHeight(0.845F);
+    private static final EntityDimensions SITTING_DIMENSIONS = EntityDimensions.scalable(EntityType.CAMEL.getWidth(), EntityType.CAMEL.getHeight() - 1.43F).withEyeHeight(0.845F);
     private int dashCooldown = 0;
     private int idleAnimationTimeout = 0;
 
@@ -78,41 +78,39 @@
         super(type, world);
         this.moveControl = new Camel.CamelMoveControl();
         this.lookControl = new Camel.CamelLookControl();
-        GroundPathNavigation groundPathNavigation = (GroundPathNavigation)this.getNavigation();
-        groundPathNavigation.setCanFloat(true);
-        groundPathNavigation.setCanWalkOverFences(true);
+        GroundPathNavigation navigation = (GroundPathNavigation) this.getNavigation();
+
+        navigation.setCanFloat(true);
+        navigation.setCanWalkOverFences(true);
     }
 
     @Override
     public void addAdditionalSaveData(CompoundTag nbt) {
         super.addAdditionalSaveData(nbt);
-        nbt.putLong("LastPoseTick", this.entityData.get(LAST_POSE_CHANGE_TICK));
+        nbt.putLong("LastPoseTick", (Long) this.entityData.get(Camel.LAST_POSE_CHANGE_TICK));
     }
 
     @Override
     public void readAdditionalSaveData(CompoundTag nbt) {
         super.readAdditionalSaveData(nbt);
-        long l = nbt.getLong("LastPoseTick");
-        if (l < 0L) {
+        long i = nbt.getLong("LastPoseTick");
+
+        if (i < 0L) {
             this.setPose(Pose.SITTING);
         }
 
-        this.resetLastPoseChangeTick(l);
+        this.resetLastPoseChangeTick(i);
     }
 
     public static AttributeSupplier.Builder createAttributes() {
-        return createBaseHorseAttributes()
-            .add(Attributes.MAX_HEALTH, 32.0)
-            .add(Attributes.MOVEMENT_SPEED, 0.09F)
-            .add(Attributes.JUMP_STRENGTH, 0.42F)
-            .add(Attributes.STEP_HEIGHT, 1.5);
+        return createBaseHorseAttributes().add(Attributes.MAX_HEALTH, 32.0D).add(Attributes.MOVEMENT_SPEED, 0.09000000357627869D).add(Attributes.JUMP_STRENGTH, 0.41999998688697815D).add(Attributes.STEP_HEIGHT, 1.5D);
     }
 
     @Override
     protected void defineSynchedData(SynchedEntityData.Builder builder) {
         super.defineSynchedData(builder);
-        builder.define(DASH, false);
-        builder.define(LAST_POSE_CHANGE_TICK, 0L);
+        builder.define(Camel.DASH, false);
+        builder.define(Camel.LAST_POSE_CHANGE_TICK, 0L);
     }
 
     @Override
@@ -128,8 +126,7 @@
     }
 
     @Override
-    protected void registerGoals() {
-    }
+    protected void registerGoals() {}
 
     @Override
     protected Brain<?> makeBrain(Dynamic<?> dynamic) {
@@ -138,14 +135,15 @@
 
     @Override
     public EntityDimensions getDefaultDimensions(Pose pose) {
-        return pose == Pose.SITTING ? SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose);
+        return pose == Pose.SITTING ? Camel.SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose);
     }
 
     @Override
     protected void customServerAiStep() {
         this.level().getProfiler().push("camelBrain");
-        Brain<?> brain = this.getBrain();
-        ((Brain<Camel>)brain).tick((ServerLevel)this.level(), this);
+        Brain<Camel> behaviorcontroller = (Brain<Camel>) this.getBrain(); // CraftBukkit - decompile error
+
+        behaviorcontroller.tick((ServerLevel) this.level(), this);
         this.level().getProfiler().pop();
         this.level().getProfiler().push("camelActivityUpdate");
         CamelAi.updateActivity(this);
@@ -161,9 +159,9 @@
         }
 
         if (this.dashCooldown > 0) {
-            this.dashCooldown--;
+            --this.dashCooldown;
             if (this.dashCooldown == 0) {
-                this.level().playSound(null, this.blockPosition(), SoundEvents.CAMEL_DASH_READY, SoundSource.NEUTRAL, 1.0F, 1.0F);
+                this.level().playSound((Player) null, this.blockPosition(), SoundEvents.CAMEL_DASH_READY, SoundSource.NEUTRAL, 1.0F, 1.0F);
             }
         }
 
@@ -178,6 +176,7 @@
         if (this.isCamelSitting() && this.isInWater()) {
             this.standUpInstantly();
         }
+
     }
 
     private void setupAnimationStates() {
@@ -185,7 +184,7 @@
             this.idleAnimationTimeout = this.random.nextInt(40) + 80;
             this.idleAnimationState.start(this.tickCount);
         } else {
-            this.idleAnimationTimeout--;
+            --this.idleAnimationTimeout;
         }
 
         if (this.isCamelVisuallySitting()) {
@@ -204,25 +203,27 @@
             this.dashAnimationState.animateWhen(this.isDashing(), this.tickCount);
             this.sitUpAnimationState.animateWhen(this.isInPoseTransition() && this.getPoseTime() >= 0L, this.tickCount);
         }
+
     }
 
     @Override
     protected void updateWalkAnimation(float posDelta) {
-        float f;
+        float f1;
+
         if (this.getPose() == Pose.STANDING && !this.dashAnimationState.isStarted()) {
-            f = Math.min(posDelta * 6.0F, 1.0F);
+            f1 = Math.min(posDelta * 6.0F, 1.0F);
         } else {
-            f = 0.0F;
+            f1 = 0.0F;
         }
 
-        this.walkAnimation.update(f, 0.2F);
+        this.walkAnimation.update(f1, 0.2F);
     }
 
     @Override
     public void travel(Vec3 movementInput) {
         if (this.refuseToMove() && this.onGround()) {
-            this.setDeltaMovement(this.getDeltaMovement().multiply(0.0, 1.0, 0.0));
-            movementInput = movementInput.multiply(0.0, 1.0, 0.0);
+            this.setDeltaMovement(this.getDeltaMovement().multiply(0.0D, 1.0D, 0.0D));
+            movementInput = movementInput.multiply(0.0D, 1.0D, 0.0D);
         }
 
         super.travel(movementInput);
@@ -234,6 +235,7 @@
         if (controllingPlayer.zza > 0.0F && this.isCamelSitting() && !this.isInPoseTransition()) {
             this.standUp();
         }
+
     }
 
     public boolean refuseToMove() {
@@ -243,7 +245,8 @@
     @Override
     protected float getRiddenSpeed(Player controllingPlayer) {
         float f = controllingPlayer.isSprinting() && this.getJumpCooldown() == 0 ? 0.1F : 0.0F;
-        return (float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) + f;
+
+        return (float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) + f;
     }
 
     @Override
@@ -275,25 +278,20 @@
 
     @Override
     protected void executeRidersJump(float strength, Vec3 movementInput) {
-        double d = (double)this.getJumpPower();
-        this.addDeltaMovement(
-            this.getLookAngle()
-                .multiply(1.0, 0.0, 1.0)
-                .normalize()
-                .scale((double)(22.2222F * strength) * this.getAttributeValue(Attributes.MOVEMENT_SPEED) * (double)this.getBlockSpeedFactor())
-                .add(0.0, (double)(1.4285F * strength) * d, 0.0)
-        );
+        double d0 = (double) this.getJumpPower();
+
+        this.addDeltaMovement(this.getLookAngle().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double) (22.2222F * strength) * this.getAttributeValue(Attributes.MOVEMENT_SPEED) * (double) this.getBlockSpeedFactor()).add(0.0D, (double) (1.4285F * strength) * d0, 0.0D));
         this.dashCooldown = 55;
         this.setDashing(true);
         this.hasImpulse = true;
     }
 
     public boolean isDashing() {
-        return this.entityData.get(DASH);
+        return (Boolean) this.entityData.get(Camel.DASH);
     }
 
     public void setDashing(boolean dashing) {
-        this.entityData.set(DASH, dashing);
+        this.entityData.set(Camel.DASH, dashing);
     }
 
     @Override
@@ -304,8 +302,7 @@
     }
 
     @Override
-    public void handleStopJump() {
-    }
+    public void handleStopJump() {}
 
     @Override
     public int getJumpCooldown() {
@@ -334,6 +331,7 @@
         } else {
             this.playSound(SoundEvents.CAMEL_STEP, 1.0F, 1.0F);
         }
+
     }
 
     @Override
@@ -343,16 +341,18 @@
 
     @Override
     public InteractionResult mobInteract(Player player, InteractionHand hand) {
-        ItemStack itemStack = player.getItemInHand(hand);
+        ItemStack itemstack = player.getItemInHand(hand);
+
         if (player.isSecondaryUseActive() && !this.isBaby()) {
             this.openCustomInventoryScreen(player);
             return InteractionResult.sidedSuccess(this.level().isClientSide);
         } else {
-            InteractionResult interactionResult = itemStack.interactLivingEntity(player, this, hand);
-            if (interactionResult.consumesAction()) {
-                return interactionResult;
-            } else if (this.isFood(itemStack)) {
-                return this.fedFood(player, itemStack);
+            InteractionResult enuminteractionresult = itemstack.interactLivingEntity(player, this, hand);
+
+            if (enuminteractionresult.consumesAction()) {
+                return enuminteractionresult;
+            } else if (this.isFood(itemstack)) {
+                return this.fedFood(player, itemstack);
             } else {
                 if (this.getPassengers().size() < 2 && !this.isBaby()) {
                     this.doPlayerRide(player);
@@ -368,6 +368,7 @@
         if (leashLength > 6.0F && this.isCamelSitting() && !this.isInPoseTransition() && this.canCamelChangePose()) {
             this.standUp();
         }
+
     }
 
     public boolean canCamelChangePose() {
@@ -379,41 +380,35 @@
         if (!this.isFood(item)) {
             return false;
         } else {
-            boolean bl = this.getHealth() < this.getMaxHealth();
-            if (bl) {
-                this.heal(2.0F);
+            boolean flag = this.getHealth() < this.getMaxHealth();
+
+            if (flag) {
+                this.heal(2.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper - Add missing regain reason
             }
 
-            boolean bl2 = this.isTamed() && this.getAge() == 0 && this.canFallInLove();
-            if (bl2) {
-                this.setInLove(player);
+            boolean flag1 = this.isTamed() && this.getAge() == 0 && this.canFallInLove();
+
+            if (flag1) {
+                this.setInLove(player, item.copy()); // Paper - Fix EntityBreedEvent copying
             }
 
-            boolean bl3 = this.isBaby();
-            if (bl3) {
-                this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0), this.getRandomY() + 0.5, this.getRandomZ(1.0), 0.0, 0.0, 0.0);
+            boolean flag2 = this.isBaby();
+
+            if (flag2) {
+                this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D);
                 if (!this.level().isClientSide) {
                     this.ageUp(10);
                 }
             }
 
-            if (!bl && !bl2 && !bl3) {
+            if (!flag && !flag1 && !flag2) {
                 return false;
             } else {
                 if (!this.isSilent()) {
-                    SoundEvent soundEvent = this.getEatingSound();
-                    if (soundEvent != null) {
-                        this.level()
-                            .playSound(
-                                null,
-                                this.getX(),
-                                this.getY(),
-                                this.getZ(),
-                                soundEvent,
-                                this.getSoundSource(),
-                                1.0F,
-                                1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F
-                            );
+                    SoundEvent soundeffect = this.getEatingSound();
+
+                    if (soundeffect != null) {
+                        this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), soundeffect, this.getSoundSource(), 1.0F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
                     }
                 }
 
@@ -430,17 +425,23 @@
 
     @Override
     public boolean canMate(Animal other) {
-        if (other != this && other instanceof Camel camel && this.canParent() && camel.canParent()) {
-            return true;
+        boolean flag;
+
+        if (other != this && other instanceof Camel camel) {
+            if (this.canParent() && camel.canParent()) {
+                flag = true;
+                return flag;
+            }
         }
 
-        return false;
+        flag = false;
+        return flag;
     }
 
     @Nullable
     @Override
-    public Camel getBreedOffspring(ServerLevel serverLevel, AgeableMob ageableMob) {
-        return EntityType.CAMEL.create(serverLevel);
+    public Camel getBreedOffspring(ServerLevel world, AgeableMob entity) {
+        return (Camel) EntityType.CAMEL.create(world);
     }
 
     @Nullable
@@ -450,28 +451,35 @@
     }
 
     @Override
-    protected void actuallyHurt(DamageSource source, float amount) {
+    // CraftBukkit start - void -> boolean
+    public boolean actuallyHurt(DamageSource damagesource, float f) {
+        boolean hurt = super.actuallyHurt(damagesource, f);
+        if (!hurt) {
+            return hurt;
+        }
+        // CraftBukkit end
         this.standUpInstantly();
-        super.actuallyHurt(source, amount);
+        return hurt; // CraftBukkit
     }
 
     @Override
     protected Vec3 getPassengerAttachmentPoint(Entity passenger, EntityDimensions dimensions, float scaleFactor) {
         int i = Math.max(this.getPassengers().indexOf(passenger), 0);
-        boolean bl = i == 0;
-        float f = 0.5F;
-        float g = (float)(this.isRemoved() ? 0.01F : this.getBodyAnchorAnimationYOffset(bl, 0.0F, dimensions, scaleFactor));
+        boolean flag = i == 0;
+        float f1 = 0.5F;
+        float f2 = (float) (this.isRemoved() ? 0.009999999776482582D : this.getBodyAnchorAnimationYOffset(flag, 0.0F, dimensions, scaleFactor));
+
         if (this.getPassengers().size() > 1) {
-            if (!bl) {
-                f = -0.7F;
+            if (!flag) {
+                f1 = -0.7F;
             }
 
             if (passenger instanceof Animal) {
-                f += 0.2F;
+                f1 += 0.2F;
             }
         }
 
-        return new Vec3(0.0, (double)g, (double)(f * scaleFactor)).yRot(-this.getYRot() * (float) (Math.PI / 180.0));
+        return (new Vec3(0.0D, (double) f2, (double) (f1 * scaleFactor))).yRot(-this.getYRot() * 0.017453292F);
     }
 
     @Override
@@ -480,45 +488,47 @@
     }
 
     private double getBodyAnchorAnimationYOffset(boolean primaryPassenger, float tickDelta, EntityDimensions dimensions, float scaleFactor) {
-        double d = (double)(dimensions.height() - 0.375F * scaleFactor);
-        float f = scaleFactor * 1.43F;
-        float g = f - scaleFactor * 0.2F;
-        float h = f - g;
-        boolean bl = this.isInPoseTransition();
-        boolean bl2 = this.isCamelSitting();
-        if (bl) {
-            int i = bl2 ? 40 : 52;
+        double d0 = (double) (dimensions.height() - 0.375F * scaleFactor);
+        float f2 = scaleFactor * 1.43F;
+        float f3 = f2 - scaleFactor * 0.2F;
+        float f4 = f2 - f3;
+        boolean flag1 = this.isInPoseTransition();
+        boolean flag2 = this.isCamelSitting();
+
+        if (flag1) {
+            int i = flag2 ? 40 : 52;
             int j;
-            float k;
-            if (bl2) {
+            float f5;
+
+            if (flag2) {
                 j = 28;
-                k = primaryPassenger ? 0.5F : 0.1F;
+                f5 = primaryPassenger ? 0.5F : 0.1F;
             } else {
                 j = primaryPassenger ? 24 : 32;
-                k = primaryPassenger ? 0.6F : 0.35F;
+                f5 = primaryPassenger ? 0.6F : 0.35F;
             }
 
-            float n = Mth.clamp((float)this.getPoseTime() + tickDelta, 0.0F, (float)i);
-            boolean bl3 = n < (float)j;
-            float o = bl3 ? n / (float)j : (n - (float)j) / (float)(i - j);
-            float p = f - k * g;
-            d += bl2 ? (double)Mth.lerp(o, bl3 ? f : p, bl3 ? p : h) : (double)Mth.lerp(o, bl3 ? h - f : h - p, bl3 ? h - p : 0.0F);
+            float f6 = Mth.clamp((float) this.getPoseTime() + tickDelta, 0.0F, (float) i);
+            boolean flag3 = f6 < (float) j;
+            float f7 = flag3 ? f6 / (float) j : (f6 - (float) j) / (float) (i - j);
+            float f8 = f2 - f5 * f3;
+
+            d0 += flag2 ? (double) Mth.lerp(f7, flag3 ? f2 : f8, flag3 ? f8 : f4) : (double) Mth.lerp(f7, flag3 ? f4 - f2 : f4 - f8, flag3 ? f4 - f8 : 0.0F);
         }
 
-        if (bl2 && !bl) {
-            d += (double)h;
+        if (flag2 && !flag1) {
+            d0 += (double) f4;
         }
 
-        return d;
+        return d0;
     }
 
     @Override
     public Vec3 getLeashOffset(float tickDelta) {
-        EntityDimensions entityDimensions = this.getDimensions(this.getPose());
-        float f = this.getAgeScale();
-        return new Vec3(
-            0.0, this.getBodyAnchorAnimationYOffset(true, tickDelta, entityDimensions, f) - (double)(0.2F * f), (double)(entityDimensions.width() * 0.56F)
-        );
+        EntityDimensions entitysize = this.getDimensions(this.getPose());
+        float f1 = this.getAgeScale();
+
+        return new Vec3(0.0D, this.getBodyAnchorAnimationYOffset(true, tickDelta, entitysize, f1) - (double) (0.2F * f1), (double) (entitysize.width() * 0.56F));
     }
 
     @Override
@@ -538,7 +548,7 @@
     }
 
     public boolean isCamelSitting() {
-        return this.entityData.get(LAST_POSE_CHANGE_TICK) < 0L;
+        return (Long) this.entityData.get(Camel.LAST_POSE_CHANGE_TICK) < 0L;
     }
 
     public boolean isCamelVisuallySitting() {
@@ -546,8 +556,9 @@
     }
 
     public boolean isInPoseTransition() {
-        long l = this.getPoseTime();
-        return l < (long)(this.isCamelSitting() ? 40 : 52);
+        long i = this.getPoseTime();
+
+        return i < (long) (this.isCamelSitting() ? 40 : 52);
     }
 
     private boolean isVisuallySittingDown() {
@@ -555,7 +566,7 @@
     }
 
     public void sitDown() {
-        if (!this.isCamelSitting()) {
+        if (!this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), true).callEvent()) { // Paper - Add EntityToggleSitEvent
             this.makeSound(SoundEvents.CAMEL_SIT);
             this.setPose(Pose.SITTING);
             this.gameEvent(GameEvent.ENTITY_ACTION);
@@ -564,7 +575,7 @@
     }
 
     public void standUp() {
-        if (this.isCamelSitting()) {
+        if (this.isCamelSitting() && new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) { // Paper - Add EntityToggleSitEvent
             this.makeSound(SoundEvents.CAMEL_STAND);
             this.setPose(Pose.STANDING);
             this.gameEvent(GameEvent.ENTITY_ACTION);
@@ -573,6 +584,7 @@
     }
 
     public void standUpInstantly() {
+        if (this.isCamelSitting() && !new io.papermc.paper.event.entity.EntityToggleSitEvent(this.getBukkitEntity(), false).callEvent()) return; // Paper - Add EntityToggleSitEvent
         this.setPose(Pose.STANDING);
         this.gameEvent(GameEvent.ENTITY_ACTION);
         this.resetLastPoseChangeTickToFullStand(this.level().getGameTime());
@@ -580,7 +592,7 @@
 
     @VisibleForTesting
     public void resetLastPoseChangeTick(long lastPoseTick) {
-        this.entityData.set(LAST_POSE_CHANGE_TICK, lastPoseTick);
+        this.entityData.set(Camel.LAST_POSE_CHANGE_TICK, lastPoseTick);
     }
 
     private void resetLastPoseChangeTickToFullStand(long time) {
@@ -588,7 +600,7 @@
     }
 
     public long getPoseTime() {
-        return this.level().getGameTime() - Math.abs(this.entityData.get(LAST_POSE_CHANGE_TICK));
+        return this.level().getGameTime() - Math.abs((Long) this.entityData.get(Camel.LAST_POSE_CHANGE_TICK));
     }
 
     @Override
@@ -598,7 +610,7 @@
 
     @Override
     public void onSyncedDataUpdated(EntityDataAccessor<?> data) {
-        if (!this.firstTick && DASH.equals(data)) {
+        if (!this.firstTick && Camel.DASH.equals(data)) {
             this.dashCooldown = this.dashCooldown == 0 ? 55 : this.dashCooldown;
         }
 
@@ -615,6 +627,7 @@
         if (!this.level().isClientSide) {
             player.openHorseInventory(this, this.inventory);
         }
+
     }
 
     @Override
@@ -622,20 +635,24 @@
         return new Camel.CamelBodyRotationControl(this);
     }
 
-    class CamelBodyRotationControl extends BodyRotationControl {
-        public CamelBodyRotationControl(final Camel camel) {
-            super(camel);
+    private class CamelMoveControl extends MoveControl {
+
+        public CamelMoveControl() {
+            super(Camel.this);
         }
 
         @Override
-        public void clientTick() {
-            if (!Camel.this.refuseToMove()) {
-                super.clientTick();
+        public void tick() {
+            if (this.operation == MoveControl.Operation.MOVE_TO && !Camel.this.isLeashed() && Camel.this.isCamelSitting() && !Camel.this.isInPoseTransition() && Camel.this.canCamelChangePose()) {
+                Camel.this.standUp();
             }
+
+            super.tick();
         }
     }
 
-    class CamelLookControl extends LookControl {
+    private class CamelLookControl extends LookControl {
+
         CamelLookControl() {
             super(Camel.this);
         }
@@ -645,25 +662,22 @@
             if (!Camel.this.hasControllingPassenger()) {
                 super.tick();
             }
+
         }
     }
 
-    class CamelMoveControl extends MoveControl {
-        public CamelMoveControl() {
-            super(Camel.this);
+    private class CamelBodyRotationControl extends BodyRotationControl {
+
+        public CamelBodyRotationControl(final Camel camel) {
+            super(camel);
         }
 
         @Override
-        public void tick() {
-            if (this.operation == MoveControl.Operation.MOVE_TO
-                && !Camel.this.isLeashed()
-                && Camel.this.isCamelSitting()
-                && !Camel.this.isInPoseTransition()
-                && Camel.this.canCamelChangePose()) {
-                Camel.this.standUp();
+        public void clientTick() {
+            if (!Camel.this.refuseToMove()) {
+                super.clientTick();
             }
 
-            super.tick();
         }
     }
 }
