diff options
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Wolf.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Wolf.java.patch | 592 |
1 files changed, 592 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Wolf.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Wolf.java.patch new file mode 100644 index 0000000000..0b586a49a0 --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/animal/Wolf.java.patch @@ -0,0 +1,592 @@ +--- a/net/minecraft/world/entity/animal/Wolf.java ++++ b/net/minecraft/world/entity/animal/Wolf.java +@@ -17,18 +17,18 @@ + import net.minecraft.util.RandomSource; + import net.minecraft.util.TimeUtil; + import net.minecraft.util.valueproviders.UniformInt; +-import net.minecraft.world.InteractionHand; ++import net.minecraft.world.EnumHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.AgeableMob; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityDimensions; ++import net.minecraft.world.entity.EntityPose; + import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.EnumMobSpawn; + import net.minecraft.world.entity.LivingEntity; + import net.minecraft.world.entity.Mob; +-import net.minecraft.world.entity.MobSpawnType; + import net.minecraft.world.entity.NeutralMob; +-import net.minecraft.world.entity.Pose; + import net.minecraft.world.entity.TamableAnimal; + import net.minecraft.world.entity.ai.attributes.AttributeSupplier; + import net.minecraft.world.entity.ai.attributes.Attributes; +@@ -64,19 +64,27 @@ + import net.minecraft.world.item.Items; + import net.minecraft.world.level.Level; + import net.minecraft.world.level.LevelAccessor; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.gameevent.GameEvent; + import net.minecraft.world.level.pathfinder.BlockPathTypes; + import net.minecraft.world.phys.Vec3; + import org.joml.Vector3f; + ++// CraftBukkit start ++import org.bukkit.event.entity.EntityRegainHealthEvent; ++import org.bukkit.event.entity.EntityTargetEvent; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++// CraftBukkit end ++ + public class Wolf extends TamableAnimal implements NeutralMob { ++ + private static final EntityDataAccessor<Boolean> DATA_INTERESTED_ID = SynchedEntityData.defineId(Wolf.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor<Integer> DATA_COLLAR_COLOR = SynchedEntityData.defineId(Wolf.class, EntityDataSerializers.INT); + private static final EntityDataAccessor<Integer> DATA_REMAINING_ANGER_TIME = SynchedEntityData.defineId(Wolf.class, EntityDataSerializers.INT); +- public static final Predicate<LivingEntity> PREY_SELECTOR = entity -> { +- EntityType<?> type = entity.getType(); +- return type == EntityType.SHEEP || type == EntityType.RABBIT || type == EntityType.FOX; ++ public static final Predicate<LivingEntity> PREY_SELECTOR = (entityliving) -> { ++ EntityType<?> entitytypes = entityliving.getType(); ++ ++ return entitytypes == EntityType.SHEEP || entitytypes == EntityType.RABBIT || entitytypes == EntityType.FOX; + }; + private static final float START_HEALTH = 8.0F; + private static final float TAME_HEALTH = 20.0F; +@@ -100,48 +108,48 @@ + @Override + protected void registerGoals() { + this.goalSelector.addGoal(1, new FloatGoal(this)); +- this.goalSelector.addGoal(1, new Wolf.WolfPanicGoal(1.5)); ++ this.goalSelector.addGoal(1, new Wolf.WolfPanicGoal(1.5D)); + this.goalSelector.addGoal(2, new SitWhenOrderedToGoal(this)); +- this.goalSelector.addGoal(3, new Wolf.WolfAvoidEntityGoal<>(this, Llama.class, 24.0F, 1.5, 1.5)); ++ this.goalSelector.addGoal(3, new Wolf.WolfAvoidEntityGoal<>(this, Llama.class, 24.0F, 1.5D, 1.5D)); + this.goalSelector.addGoal(4, new LeapAtTargetGoal(this, 0.4F)); +- this.goalSelector.addGoal(5, new MeleeAttackGoal(this, 1.0, true)); +- this.goalSelector.addGoal(6, new FollowOwnerGoal(this, 1.0, 10.0F, 2.0F, false)); +- this.goalSelector.addGoal(7, new BreedGoal(this, 1.0)); +- this.goalSelector.addGoal(8, new WaterAvoidingRandomStrollGoal(this, 1.0)); ++ this.goalSelector.addGoal(5, new MeleeAttackGoal(this, 1.0D, true)); ++ this.goalSelector.addGoal(6, new FollowOwnerGoal(this, 1.0D, 10.0F, 2.0F, false)); ++ this.goalSelector.addGoal(7, new BreedGoal(this, 1.0D)); ++ this.goalSelector.addGoal(8, new WaterAvoidingRandomStrollGoal(this, 1.0D)); + this.goalSelector.addGoal(9, new BegGoal(this, 8.0F)); + this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Player.class, 8.0F)); + this.goalSelector.addGoal(10, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(1, new OwnerHurtByTargetGoal(this)); + this.targetSelector.addGoal(2, new OwnerHurtTargetGoal(this)); +- this.targetSelector.addGoal(3, new HurtByTargetGoal(this).setAlertOthers()); ++ this.targetSelector.addGoal(3, (new HurtByTargetGoal(this, new Class[0])).setAlertOthers()); + this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt)); +- this.targetSelector.addGoal(5, new NonTameRandomTargetGoal<>(this, Animal.class, false, PREY_SELECTOR)); ++ this.targetSelector.addGoal(5, new NonTameRandomTargetGoal<>(this, Animal.class, false, Wolf.PREY_SELECTOR)); + this.targetSelector.addGoal(6, new NonTameRandomTargetGoal<>(this, Turtle.class, false, Turtle.BABY_ON_LAND_SELECTOR)); + this.targetSelector.addGoal(7, new NearestAttackableTargetGoal<>(this, AbstractSkeleton.class, false)); + this.targetSelector.addGoal(8, new ResetUniversalAngerTargetGoal<>(this, true)); + } + + public static AttributeSupplier.Builder createAttributes() { +- return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.3F).add(Attributes.MAX_HEALTH, 8.0).add(Attributes.ATTACK_DAMAGE, 2.0); ++ return Mob.createMobAttributes().add(Attributes.MOVEMENT_SPEED, 0.30000001192092896D).add(Attributes.MAX_HEALTH, 8.0D).add(Attributes.ATTACK_DAMAGE, 2.0D); + } + + @Override + protected void defineSynchedData() { + super.defineSynchedData(); +- this.entityData.define(DATA_INTERESTED_ID, false); +- this.entityData.define(DATA_COLLAR_COLOR, DyeColor.RED.getId()); +- this.entityData.define(DATA_REMAINING_ANGER_TIME, 0); ++ this.entityData.define(Wolf.DATA_INTERESTED_ID, false); ++ this.entityData.define(Wolf.DATA_COLLAR_COLOR, DyeColor.RED.getId()); ++ this.entityData.define(Wolf.DATA_REMAINING_ANGER_TIME, 0); + } + + @Override +- protected void playStepSound(BlockPos pos, BlockState block) { ++ protected void playStepSound(BlockPos pos, IBlockData block) { + this.playSound(SoundEvents.WOLF_STEP, 0.15F, 1.0F); + } + + @Override + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); +- compound.putByte("CollarColor", (byte)this.getCollarColor().getId()); ++ compound.putByte("CollarColor", (byte) this.getCollarColor().getId()); + this.addPersistentAngerSaveData(compound); + } + +@@ -157,13 +165,7 @@ + + @Override + protected SoundEvent getAmbientSound() { +- if (this.isAngry()) { +- return SoundEvents.WOLF_GROWL; +- } else if (this.random.nextInt(3) == 0) { +- return this.isTame() && this.getHealth() < 10.0F ? SoundEvents.WOLF_WHINE : SoundEvents.WOLF_PANT; +- } else { +- return SoundEvents.WOLF_AMBIENT; +- } ++ return this.isAngry() ? SoundEvents.WOLF_GROWL : (this.random.nextInt(3) == 0 ? (this.isTame() && this.getHealth() < 10.0F ? SoundEvents.WOLF_WHINE : SoundEvents.WOLF_PANT) : SoundEvents.WOLF_AMBIENT); + } + + @Override +@@ -188,12 +190,13 @@ + this.isShaking = true; + this.shakeAnim = 0.0F; + this.shakeAnimO = 0.0F; +- this.level().broadcastEntityEvent(this, (byte)8); ++ this.level().broadcastEntityEvent(this, (byte) 8); + } + + if (!this.level().isClientSide) { +- this.updatePersistentAnger((ServerLevel)this.level(), true); ++ this.updatePersistentAnger((ServerLevel) this.level(), true); + } ++ + } + + @Override +@@ -202,15 +205,15 @@ + if (this.isAlive()) { + this.interestedAngleO = this.interestedAngle; + if (this.isInterested()) { +- this.interestedAngle = this.interestedAngle + (1.0F - this.interestedAngle) * 0.4F; ++ this.interestedAngle += (1.0F - this.interestedAngle) * 0.4F; + } else { +- this.interestedAngle = this.interestedAngle + (0.0F - this.interestedAngle) * 0.4F; ++ this.interestedAngle += (0.0F - this.interestedAngle) * 0.4F; + } + + if (this.isInWaterRainOrBubble()) { + this.isWet = true; + if (this.isShaking && !this.level().isClientSide) { +- this.level().broadcastEntityEvent(this, (byte)56); ++ this.level().broadcastEntityEvent(this, (byte) 56); + this.cancelShake(); + } + } else if ((this.isWet || this.isShaking) && this.isShaking) { +@@ -229,26 +232,19 @@ + } + + if (this.shakeAnim > 0.4F) { +- float f = (float)this.getY(); +- int i = (int)(Mth.sin((this.shakeAnim - 0.4F) * (float) Math.PI) * 7.0F); +- Vec3 deltaMovement = this.getDeltaMovement(); ++ float f = (float) this.getY(); ++ int i = (int) (Mth.sin((this.shakeAnim - 0.4F) * 3.1415927F) * 7.0F); ++ Vec3 vec3d = this.getDeltaMovement(); + +- for (int i1 = 0; i1 < i; i1++) { ++ for (int j = 0; j < i; ++j) { + float f1 = (this.random.nextFloat() * 2.0F - 1.0F) * this.getBbWidth() * 0.5F; + float f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.getBbWidth() * 0.5F; +- this.level() +- .addParticle( +- ParticleTypes.SPLASH, +- this.getX() + (double)f1, +- (double)(f + 0.8F), +- this.getZ() + (double)f2, +- deltaMovement.x, +- deltaMovement.y, +- deltaMovement.z +- ); ++ ++ this.level().addParticle(ParticleTypes.SPLASH, this.getX() + (double) f1, (double) (f + 0.8F), this.getZ() + (double) f2, vec3d.x, vec3d.y, vec3d.z); + } + } + } ++ + } + } + +@@ -276,22 +272,23 @@ + } + + public float getBodyRollAngle(float partialTicks, float offset) { +- float f = (Mth.lerp(partialTicks, this.shakeAnimO, this.shakeAnim) + offset) / 1.8F; +- if (f < 0.0F) { +- f = 0.0F; +- } else if (f > 1.0F) { +- f = 1.0F; ++ float f2 = (Mth.lerp(partialTicks, this.shakeAnimO, this.shakeAnim) + offset) / 1.8F; ++ ++ if (f2 < 0.0F) { ++ f2 = 0.0F; ++ } else if (f2 > 1.0F) { ++ f2 = 1.0F; + } + +- return Mth.sin(f * (float) Math.PI) * Mth.sin(f * (float) Math.PI * 11.0F) * 0.15F * (float) Math.PI; ++ return Mth.sin(f2 * 3.1415927F) * Mth.sin(f2 * 3.1415927F * 11.0F) * 0.15F * 3.1415927F; + } + + public float getHeadRollAngle(float partialTicks) { +- return Mth.lerp(partialTicks, this.interestedAngleO, this.interestedAngle) * 0.15F * (float) Math.PI; ++ return Mth.lerp(partialTicks, this.interestedAngleO, this.interestedAngle) * 0.15F * 3.1415927F; + } + + @Override +- protected float getStandingEyeHeight(Pose pose, EntityDimensions size) { ++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) { + return size.height * 0.8F; + } + +@@ -306,21 +303,27 @@ + return false; + } else { + Entity entity = source.getEntity(); +- if (!this.level().isClientSide) { +- this.setOrderedToSit(false); +- } + ++ // CraftBukkit - move diff down ++ + if (entity != null && !(entity instanceof Player) && !(entity instanceof AbstractArrow)) { + amount = (amount + 1.0F) / 2.0F; + } + +- return super.hurt(source, amount); ++ // CraftBukkit start ++ boolean result = super.hurt(source, amount); ++ if (!this.level().isClientSide && result) { ++ this.setOrderedToSit(false); ++ } ++ return result; ++ // CraftBukkit end + } + } + + @Override + public boolean doHurtTarget(Entity entity) { +- boolean flag = entity.hurt(this.damageSources().mobAttack(this), (float)((int)this.getAttributeValue(Attributes.ATTACK_DAMAGE))); ++ boolean flag = entity.hurt(this.damageSources().mobAttack(this), (float) ((int) this.getAttributeValue(Attributes.ATTACK_DAMAGE))); ++ + if (flag) { + this.doEnchantDamageEffects(this, entity); + } +@@ -332,69 +335,78 @@ + public void setTame(boolean tamed) { + super.setTame(tamed); + if (tamed) { +- this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(20.0); +- this.setHealth(20.0F); ++ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(20.0D); ++ this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth() + } else { +- this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(8.0); ++ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(8.0D); + } + +- this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(4.0); ++ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(4.0D); + } + + @Override +- public InteractionResult mobInteract(Player player, InteractionHand hand) { +- ItemStack itemInHand = player.getItemInHand(hand); +- Item item = itemInHand.getItem(); ++ public InteractionResult mobInteract(Player player, EnumHand hand) { ++ ItemStack itemstack = player.getItemInHand(hand); ++ Item item = itemstack.getItem(); ++ + if (this.level().isClientSide) { +- boolean flag = this.isOwnedBy(player) || this.isTame() || itemInHand.is(Items.BONE) && !this.isTame() && !this.isAngry(); ++ boolean flag = this.isOwnedBy(player) || this.isTame() || itemstack.is(Items.BONE) && !this.isTame() && !this.isAngry(); ++ + return flag ? InteractionResult.CONSUME : InteractionResult.PASS; + } else if (this.isTame()) { +- if (this.isFood(itemInHand) && this.getHealth() < this.getMaxHealth()) { ++ if (this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { + if (!player.getAbilities().instabuild) { +- itemInHand.shrink(1); ++ itemstack.shrink(1); + } + +- this.heal((float)item.getFoodProperties().getNutrition()); ++ this.heal((float) item.getFoodProperties().getNutrition(), EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit + return InteractionResult.SUCCESS; + } else { +- if (item instanceof DyeItem dyeItem && this.isOwnedBy(player)) { +- DyeColor dyeColor = dyeItem.getDyeColor(); +- if (dyeColor != this.getCollarColor()) { +- this.setCollarColor(dyeColor); +- if (!player.getAbilities().instabuild) { +- itemInHand.shrink(1); ++ if (item instanceof DyeItem) { ++ DyeItem itemdye = (DyeItem) item; ++ ++ if (this.isOwnedBy(player)) { ++ DyeColor enumcolor = itemdye.getDyeColor(); ++ ++ if (enumcolor != this.getCollarColor()) { ++ this.setCollarColor(enumcolor); ++ if (!player.getAbilities().instabuild) { ++ itemstack.shrink(1); ++ } ++ ++ return InteractionResult.SUCCESS; + } + +- return InteractionResult.SUCCESS; ++ return super.mobInteract(player, hand); + } +- +- return super.mobInteract(player, hand); + } + +- InteractionResult interactionResult = super.mobInteract(player, hand); +- if ((!interactionResult.consumesAction() || this.isBaby()) && this.isOwnedBy(player)) { ++ InteractionResult enuminteractionresult = super.mobInteract(player, hand); ++ ++ if ((!enuminteractionresult.consumesAction() || this.isBaby()) && this.isOwnedBy(player)) { + this.setOrderedToSit(!this.isOrderedToSit()); + this.jumping = false; + this.navigation.stop(); +- this.setTarget(null); ++ this.setTarget((LivingEntity) null, EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason + return InteractionResult.SUCCESS; + } else { +- return interactionResult; ++ return enuminteractionresult; + } + } +- } else if (itemInHand.is(Items.BONE) && !this.isAngry()) { ++ } else if (itemstack.is(Items.BONE) && !this.isAngry()) { + if (!player.getAbilities().instabuild) { +- itemInHand.shrink(1); ++ itemstack.shrink(1); + } + +- if (this.random.nextInt(3) == 0) { ++ // CraftBukkit - added event call and isCancelled check. ++ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { + this.tame(player); + this.navigation.stop(); +- this.setTarget(null); ++ this.setTarget((LivingEntity) null); + this.setOrderedToSit(true); +- this.level().broadcastEntityEvent(this, (byte)7); ++ this.level().broadcastEntityEvent(this, (byte) 7); + } else { +- this.level().broadcastEntityEvent(this, (byte)6); ++ this.level().broadcastEntityEvent(this, (byte) 6); + } + + return InteractionResult.SUCCESS; +@@ -414,19 +426,17 @@ + } else { + super.handleEntityEvent(id); + } ++ + } + + public float getTailAngle() { +- if (this.isAngry()) { +- return 1.5393804F; +- } else { +- return this.isTame() ? (0.55F - (this.getMaxHealth() - this.getHealth()) * 0.02F) * (float) Math.PI : (float) (Math.PI / 5); +- } ++ return this.isAngry() ? 1.5393804F : (this.isTame() ? (0.55F - (this.getMaxHealth() - this.getHealth()) * 0.02F) * 3.1415927F : 0.62831855F); + } + + @Override + public boolean isFood(ItemStack stack) { + Item item = stack.getItem(); ++ + return item.isEdible() && item.getFoodProperties().isMeat(); + } + +@@ -437,17 +447,17 @@ + + @Override + public int getRemainingPersistentAngerTime() { +- return this.entityData.get(DATA_REMAINING_ANGER_TIME); ++ return (Integer) this.entityData.get(Wolf.DATA_REMAINING_ANGER_TIME); + } + + @Override + public void setRemainingPersistentAngerTime(int time) { +- this.entityData.set(DATA_REMAINING_ANGER_TIME, time); ++ this.entityData.set(Wolf.DATA_REMAINING_ANGER_TIME, time); + } + + @Override + public void startPersistentAngerTimer() { +- this.setRemainingPersistentAngerTime(PERSISTENT_ANGER_TIME.sample(this.random)); ++ this.setRemainingPersistentAngerTime(Wolf.PERSISTENT_ANGER_TIME.sample(this.random)); + } + + @Nullable +@@ -462,57 +472,65 @@ + } + + public DyeColor getCollarColor() { +- return DyeColor.byId(this.entityData.get(DATA_COLLAR_COLOR)); ++ return DyeColor.byId((Integer) this.entityData.get(Wolf.DATA_COLLAR_COLOR)); + } + + public void setCollarColor(DyeColor collarColor) { +- this.entityData.set(DATA_COLLAR_COLOR, collarColor.getId()); ++ this.entityData.set(Wolf.DATA_COLLAR_COLOR, collarColor.getId()); + } + + @Nullable + @Override + public Wolf getBreedOffspring(ServerLevel level, AgeableMob otherParent) { +- Wolf wolf = EntityType.WOLF.create(level); +- if (wolf != null) { +- UUID ownerUUID = this.getOwnerUUID(); +- if (ownerUUID != null) { +- wolf.setOwnerUUID(ownerUUID); +- wolf.setTame(true); ++ Wolf entitywolf = (Wolf) EntityType.WOLF.create(level); ++ ++ if (entitywolf != null) { ++ UUID uuid = this.getOwnerUUID(); ++ ++ if (uuid != null) { ++ entitywolf.setOwnerUUID(uuid); ++ entitywolf.setTame(true); + } + } + +- return wolf; ++ return entitywolf; + } + + public void setIsInterested(boolean isInterested) { +- this.entityData.set(DATA_INTERESTED_ID, isInterested); ++ this.entityData.set(Wolf.DATA_INTERESTED_ID, isInterested); + } + + @Override + public boolean canMate(Animal otherAnimal) { +- return otherAnimal != this +- && this.isTame() +- && otherAnimal instanceof Wolf wolf +- && wolf.isTame() +- && !wolf.isInSittingPose() +- && this.isInLove() +- && wolf.isInLove(); ++ if (otherAnimal == this) { ++ return false; ++ } else if (!this.isTame()) { ++ return false; ++ } else if (!(otherAnimal instanceof Wolf)) { ++ return false; ++ } else { ++ Wolf entitywolf = (Wolf) otherAnimal; ++ ++ return !entitywolf.isTame() ? false : (entitywolf.isInSittingPose() ? false : this.isInLove() && entitywolf.isInLove()); ++ } + } + + public boolean isInterested() { +- return this.entityData.get(DATA_INTERESTED_ID); ++ return (Boolean) this.entityData.get(Wolf.DATA_INTERESTED_ID); + } + + @Override + public boolean wantsToAttack(LivingEntity target, LivingEntity owner) { +- if (target instanceof Creeper || target instanceof Ghast) { +- return false; ++ if (!(target instanceof Creeper) && !(target instanceof Ghast)) { ++ if (target instanceof Wolf) { ++ Wolf entitywolf = (Wolf) target; ++ ++ return !entitywolf.isTame() || entitywolf.getOwner() != owner; ++ } else { ++ return target instanceof Player && owner instanceof Player && !((Player) owner).canHarmPlayer((Player) target) ? false : (target instanceof AbstractHorse && ((AbstractHorse) target).isTamed() ? false : !(target instanceof TamableAnimal) || !((TamableAnimal) target).isTame()); ++ } + } else { +- return target instanceof Wolf wolf +- ? !wolf.isTame() || wolf.getOwner() != owner +- : (!(target instanceof Player) || !(owner instanceof Player) || ((Player)owner).canHarmPlayer((Player)target)) +- && (!(target instanceof AbstractHorse) || !((AbstractHorse)target).isTamed()) +- && (!(target instanceof TamableAnimal) || !((TamableAnimal)target).isTame()); ++ return false; + } + } + +@@ -523,29 +541,42 @@ + + @Override + public Vec3 getLeashOffset() { +- return new Vec3(0.0, (double)(0.6F * this.getEyeHeight()), (double)(this.getBbWidth() * 0.4F)); ++ return new Vec3(0.0D, (double) (0.6F * this.getEyeHeight()), (double) (this.getBbWidth() * 0.4F)); + } + + @Override +- protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entityDimensions, float f) { +- return new Vector3f(0.0F, entityDimensions.height - 0.03125F * f, -0.0625F * f); ++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) { ++ return new Vector3f(0.0F, entitysize.height - 0.03125F * f, -0.0625F * f); + } + +- public static boolean checkWolfSpawnRules(EntityType<Wolf> wolf, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random) { ++ public static boolean checkWolfSpawnRules(EntityType<Wolf> wolf, LevelAccessor level, EnumMobSpawn spawnType, BlockPos pos, RandomSource random) { + return level.getBlockState(pos.below()).is(BlockTags.WOLVES_SPAWNABLE_ON) && isBrightEnoughToSpawn(level, pos); + } + +- class WolfAvoidEntityGoal<T extends LivingEntity> extends AvoidEntityGoal<T> { ++ private class WolfPanicGoal extends PanicGoal { ++ ++ public WolfPanicGoal(double d0) { ++ super(Wolf.this, d0); ++ } ++ ++ @Override ++ protected boolean shouldPanic() { ++ return this.mob.isFreezing() || this.mob.isOnFire(); ++ } ++ } ++ ++ private class WolfAvoidEntityGoal<T extends LivingEntity> extends AvoidEntityGoal<T> { ++ + private final Wolf wolf; + +- public WolfAvoidEntityGoal(Wolf wolf, Class<T> entityClassToAvoid, float maxDist, double walkSpeedModifier, double sprintSpeedModifier) { +- super(wolf, entityClassToAvoid, maxDist, walkSpeedModifier, sprintSpeedModifier); +- this.wolf = wolf; ++ public WolfAvoidEntityGoal(Wolf entitywolf, Class oclass, float f, double d0, double d1) { ++ super(entitywolf, oclass, f, d0, d1); ++ this.wolf = entitywolf; + } + + @Override + public boolean canUse() { +- return super.canUse() && this.toAvoid instanceof Llama && !this.wolf.isTame() && this.avoidLlama((Llama)this.toAvoid); ++ return super.canUse() && this.toAvoid instanceof Llama ? !this.wolf.isTame() && this.avoidLlama((Llama) this.toAvoid) : false; + } + + private boolean avoidLlama(Llama llama) { +@@ -554,25 +585,14 @@ + + @Override + public void start() { +- Wolf.this.setTarget(null); ++ Wolf.this.setTarget((LivingEntity) null); + super.start(); + } + + @Override + public void tick() { +- Wolf.this.setTarget(null); ++ Wolf.this.setTarget((LivingEntity) null); + super.tick(); + } + } +- +- class WolfPanicGoal extends PanicGoal { +- public WolfPanicGoal(double speedModifier) { +- super(Wolf.this, speedModifier); +- } +- +- @Override +- protected boolean shouldPanic() { +- return this.mob.isFreezing() || this.mob.isOnFire(); +- } +- } + } |