diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Cat.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Cat.java.patch | 635 |
1 files changed, 635 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Cat.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Cat.java.patch new file mode 100644 index 0000000000..f6079cb1f7 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Cat.java.patch @@ -0,0 +1,635 @@ +--- a/net/minecraft/world/entity/animal/Cat.java ++++ b/net/minecraft/world/entity/animal/Cat.java +@@ -22,19 +22,19 @@ + import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; + import net.minecraft.world.DifficultyInstance; +-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.EntitySelector; + import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.EnumMobSpawn; ++import net.minecraft.world.entity.GroupDataEntity; + import net.minecraft.world.entity.LivingEntity; + import net.minecraft.world.entity.Mob; +-import net.minecraft.world.entity.MobSpawnType; +-import net.minecraft.world.entity.Pose; +-import net.minecraft.world.entity.SpawnGroupData; + import net.minecraft.world.entity.TamableAnimal; + import net.minecraft.world.entity.VariantHolder; + import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +@@ -65,7 +65,7 @@ + import net.minecraft.world.level.Level; + import net.minecraft.world.level.ServerLevelAccessor; + import net.minecraft.world.level.block.BedBlock; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.storage.loot.BuiltInLootTables; + import net.minecraft.world.level.storage.loot.LootParams; + import net.minecraft.world.level.storage.loot.LootTable; +@@ -94,8 +94,8 @@ + private float relaxStateOneAmount; + private float relaxStateOneAmountO; + +- public Cat(EntityType<? extends Cat> entitytype, Level level) { +- super(entitytype, level); ++ public Cat(EntityType<? extends Cat> entityType, Level level) { ++ super(entityType, level); + } + + public ResourceLocation getResourceLocation() { +@@ -103,7 +103,6 @@ + } + + @Override +- @Override + protected void registerGoals() { + this.temptGoal = new Cat.CatTemptGoal(this, 0.6D, Cat.TEMPT_INGREDIENT, true); + this.goalSelector.addGoal(1, new FloatGoal(this)); +@@ -124,26 +123,24 @@ + } + + @Override +- @Override + public CatVariant getVariant() { + return (CatVariant) this.entityData.get(Cat.DATA_VARIANT_ID); + } + +- @Override +- public void setVariant(CatVariant catvariant) { +- this.entityData.set(Cat.DATA_VARIANT_ID, catvariant); ++ public void setVariant(CatVariant variant) { ++ this.entityData.set(Cat.DATA_VARIANT_ID, variant); + } + +- public void setLying(boolean flag) { +- this.entityData.set(Cat.IS_LYING, flag); ++ public void setLying(boolean lying) { ++ this.entityData.set(Cat.IS_LYING, lying); + } + + public boolean isLying() { + return (Boolean) this.entityData.get(Cat.IS_LYING); + } + +- public void setRelaxStateOne(boolean flag) { +- this.entityData.set(Cat.RELAX_STATE_ONE, flag); ++ public void setRelaxStateOne(boolean relaxStateOne) { ++ this.entityData.set(Cat.RELAX_STATE_ONE, relaxStateOne); + } + + public boolean isRelaxStateOne() { +@@ -154,12 +151,11 @@ + return DyeColor.byId((Integer) this.entityData.get(Cat.DATA_COLLAR_COLOR)); + } + +- public void setCollarColor(DyeColor dyecolor) { +- this.entityData.set(Cat.DATA_COLLAR_COLOR, dyecolor.getId()); ++ public void setCollarColor(DyeColor color) { ++ this.entityData.set(Cat.DATA_COLLAR_COLOR, color.getId()); + } + + @Override +- @Override + protected void defineSynchedData() { + super.defineSynchedData(); + this.entityData.define(Cat.DATA_VARIANT_ID, (CatVariant) BuiltInRegistries.CAT_VARIANT.getOrThrow(CatVariant.BLACK)); +@@ -169,47 +165,44 @@ + } + + @Override +- @Override +- public void addAdditionalSaveData(CompoundTag compoundtag) { +- super.addAdditionalSaveData(compoundtag); +- compoundtag.putString("variant", BuiltInRegistries.CAT_VARIANT.getKey(this.getVariant()).toString()); +- compoundtag.putByte("CollarColor", (byte) this.getCollarColor().getId()); ++ public void addAdditionalSaveData(CompoundTag compound) { ++ super.addAdditionalSaveData(compound); ++ compound.putString("variant", BuiltInRegistries.CAT_VARIANT.getKey(this.getVariant()).toString()); ++ compound.putByte("CollarColor", (byte) this.getCollarColor().getId()); + } + + @Override +- @Override +- public void readAdditionalSaveData(CompoundTag compoundtag) { +- super.readAdditionalSaveData(compoundtag); +- CatVariant catvariant = (CatVariant) BuiltInRegistries.CAT_VARIANT.get(ResourceLocation.tryParse(compoundtag.getString("variant"))); ++ public void readAdditionalSaveData(CompoundTag compound) { ++ super.readAdditionalSaveData(compound); ++ CatVariant catvariant = (CatVariant) BuiltInRegistries.CAT_VARIANT.get(ResourceLocation.tryParse(compound.getString("variant"))); + + if (catvariant != null) { + this.setVariant(catvariant); + } + +- if (compoundtag.contains("CollarColor", 99)) { +- this.setCollarColor(DyeColor.byId(compoundtag.getInt("CollarColor"))); ++ if (compound.contains("CollarColor", 99)) { ++ this.setCollarColor(DyeColor.byId(compound.getInt("CollarColor"))); + } + + } + + @Override +- @Override + public void customServerAiStep() { + if (this.getMoveControl().hasWanted()) { + double d0 = this.getMoveControl().getSpeedModifier(); + + if (d0 == 0.6D) { +- this.setPose(Pose.CROUCHING); ++ this.setPose(EntityPose.CROUCHING); + this.setSprinting(false); + } else if (d0 == 1.33D) { +- this.setPose(Pose.STANDING); ++ this.setPose(EntityPose.STANDING); + this.setSprinting(true); + } else { +- this.setPose(Pose.STANDING); ++ this.setPose(EntityPose.STANDING); + this.setSprinting(false); + } + } else { +- this.setPose(Pose.STANDING); ++ this.setPose(EntityPose.STANDING); + this.setSprinting(false); + } + +@@ -217,13 +210,11 @@ + + @Nullable + @Override +- @Override + protected SoundEvent getAmbientSound() { + return this.isTame() ? (this.isInLove() ? SoundEvents.CAT_PURR : (this.random.nextInt(4) == 0 ? SoundEvents.CAT_PURREOW : SoundEvents.CAT_AMBIENT)) : SoundEvents.CAT_STRAY_AMBIENT; + } + + @Override +- @Override + public int getAmbientSoundInterval() { + return 120; + } +@@ -233,13 +224,11 @@ + } + + @Override +- @Override +- protected SoundEvent getHurtSound(DamageSource damagesource) { ++ protected SoundEvent getHurtSound(DamageSource damageSource) { + return SoundEvents.CAT_HURT; + } + + @Override +- @Override + protected SoundEvent getDeathSound() { + return SoundEvents.CAT_DEATH; + } +@@ -249,13 +238,12 @@ + } + + @Override +- @Override +- protected void usePlayerItem(Player player, InteractionHand interactionhand, ItemStack itemstack) { +- if (this.isFood(itemstack)) { ++ protected void usePlayerItem(Player player, EnumHand hand, ItemStack stack) { ++ if (this.isFood(stack)) { + this.playSound(SoundEvents.CAT_EAT, 1.0F, 1.0F); + } + +- super.usePlayerItem(player, interactionhand, itemstack); ++ super.usePlayerItem(player, hand, stack); + } + + private float getAttackDamage() { +@@ -263,13 +251,11 @@ + } + + @Override +- @Override + public boolean doHurtTarget(Entity entity) { + return entity.hurt(this.damageSources().mobAttack(this), this.getAttackDamage()); + } + + @Override +- @Override + public void tick() { + super.tick(); + if (this.temptGoal != null && this.temptGoal.isRunning() && !this.isTame() && this.tickCount % 100 == 0) { +@@ -311,116 +297,112 @@ + + } + +- public float getLieDownAmount(float f) { +- return Mth.lerp(f, this.lieDownAmountO, this.lieDownAmount); ++ public float getLieDownAmount(float partialTicks) { ++ return Mth.lerp(partialTicks, this.lieDownAmountO, this.lieDownAmount); + } + +- public float getLieDownAmountTail(float f) { +- return Mth.lerp(f, this.lieDownAmountOTail, this.lieDownAmountTail); ++ public float getLieDownAmountTail(float partialTicks) { ++ return Mth.lerp(partialTicks, this.lieDownAmountOTail, this.lieDownAmountTail); + } + +- public float getRelaxStateOneAmount(float f) { +- return Mth.lerp(f, this.relaxStateOneAmountO, this.relaxStateOneAmount); ++ public float getRelaxStateOneAmount(float partialTicks) { ++ return Mth.lerp(partialTicks, this.relaxStateOneAmountO, this.relaxStateOneAmount); + } + + @Nullable + @Override +- @Override +- public Cat getBreedOffspring(ServerLevel serverlevel, AgeableMob ageablemob) { +- Cat cat = (Cat) EntityType.CAT.create(serverlevel); ++ public Cat getBreedOffspring(ServerLevel level, AgeableMob otherParent) { ++ Cat entitycat = (Cat) EntityType.CAT.create(level); + +- if (cat != null && ageablemob instanceof Cat) { +- Cat cat1 = (Cat) ageablemob; ++ if (entitycat != null && otherParent instanceof Cat) { ++ Cat entitycat1 = (Cat) otherParent; + + if (this.random.nextBoolean()) { +- cat.setVariant(this.getVariant()); ++ entitycat.setVariant(this.getVariant()); + } else { +- cat.setVariant(cat1.getVariant()); ++ entitycat.setVariant(entitycat1.getVariant()); + } + + if (this.isTame()) { +- cat.setOwnerUUID(this.getOwnerUUID()); +- cat.setTame(true); ++ entitycat.setOwnerUUID(this.getOwnerUUID()); ++ entitycat.setTame(true); + if (this.random.nextBoolean()) { +- cat.setCollarColor(this.getCollarColor()); ++ entitycat.setCollarColor(this.getCollarColor()); + } else { +- cat.setCollarColor(cat1.getCollarColor()); ++ entitycat.setCollarColor(entitycat1.getCollarColor()); + } + } + } + +- return cat; ++ return entitycat; + } + + @Override +- @Override +- public boolean canMate(Animal animal) { ++ public boolean canMate(Animal otherAnimal) { + if (!this.isTame()) { + return false; +- } else if (!(animal instanceof Cat)) { ++ } else if (!(otherAnimal instanceof Cat)) { + return false; + } else { +- Cat cat = (Cat) animal; ++ Cat entitycat = (Cat) otherAnimal; + +- return cat.isTame() && super.canMate(animal); ++ return entitycat.isTame() && super.canMate(otherAnimal); + } + } + + @Nullable + @Override +- @Override +- public SpawnGroupData finalizeSpawn(ServerLevelAccessor serverlevelaccessor, DifficultyInstance difficultyinstance, MobSpawnType mobspawntype, @Nullable SpawnGroupData spawngroupdata, @Nullable CompoundTag compoundtag) { +- spawngroupdata = super.finalizeSpawn(serverlevelaccessor, difficultyinstance, mobspawntype, spawngroupdata, compoundtag); +- boolean flag = serverlevelaccessor.getMoonBrightness() > 0.9F; ++ public GroupDataEntity finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EnumMobSpawn reason, @Nullable GroupDataEntity spawnData, @Nullable CompoundTag dataTag) { ++ spawnData = super.finalizeSpawn(level, difficulty, reason, spawnData, dataTag); ++ boolean flag = level.getMoonBrightness() > 0.9F; + TagKey<CatVariant> tagkey = flag ? CatVariantTags.FULL_MOON_SPAWNS : CatVariantTags.DEFAULT_SPAWNS; + + BuiltInRegistries.CAT_VARIANT.getTag(tagkey).flatMap((holderset_named) -> { +- return holderset_named.getRandomElement(serverlevelaccessor.getRandom()); ++ return holderset_named.getRandomElement(level.getRandom()); + }).ifPresent((holder) -> { + this.setVariant((CatVariant) holder.value()); + }); +- ServerLevel serverlevel = serverlevelaccessor.getLevel(); ++ ServerLevel worldserver = level.getLevel(); + +- if (serverlevel.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK).isValid()) { ++ if (worldserver.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK).isValid()) { + this.setVariant((CatVariant) BuiltInRegistries.CAT_VARIANT.getOrThrow(CatVariant.ALL_BLACK)); + this.setPersistenceRequired(); + } + +- return spawngroupdata; ++ return spawnData; + } + + @Override +- @Override +- public InteractionResult mobInteract(Player player, InteractionHand interactionhand) { +- ItemStack itemstack = player.getItemInHand(interactionhand); ++ public InteractionResult mobInteract(Player player, EnumHand hand) { ++ ItemStack itemstack = player.getItemInHand(hand); + Item item = itemstack.getItem(); + + if (this.level().isClientSide) { + return this.isTame() && this.isOwnedBy(player) ? InteractionResult.SUCCESS : (this.isFood(itemstack) && (this.getHealth() < this.getMaxHealth() || !this.isTame()) ? InteractionResult.SUCCESS : InteractionResult.PASS); + } else { +- InteractionResult interactionresult; ++ InteractionResult enuminteractionresult; + + if (this.isTame()) { + if (this.isOwnedBy(player)) { + if (!(item instanceof DyeItem)) { + if (item.isEdible() && this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { +- this.usePlayerItem(player, interactionhand, itemstack); ++ this.usePlayerItem(player, hand, itemstack); + this.heal((float) item.getFoodProperties().getNutrition()); + return InteractionResult.CONSUME; + } + +- interactionresult = super.mobInteract(player, interactionhand); +- if (!interactionresult.consumesAction() || this.isBaby()) { ++ enuminteractionresult = super.mobInteract(player, hand); ++ if (!enuminteractionresult.consumesAction() || this.isBaby()) { + this.setOrderedToSit(!this.isOrderedToSit()); + } + +- return interactionresult; ++ return enuminteractionresult; + } + +- DyeColor dyecolor = ((DyeItem) item).getDyeColor(); ++ DyeColor enumcolor = ((DyeItem) item).getDyeColor(); + +- if (dyecolor != this.getCollarColor()) { +- this.setCollarColor(dyecolor); ++ if (enumcolor != this.getCollarColor()) { ++ this.setCollarColor(enumcolor); + if (!player.getAbilities().instabuild) { + itemstack.shrink(1); + } +@@ -430,8 +412,8 @@ + } + } + } else if (this.isFood(itemstack)) { +- this.usePlayerItem(player, interactionhand, itemstack); +- if (this.random.nextInt(3) == 0) { ++ this.usePlayerItem(player, hand, itemstack); ++ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit + this.tame(player); + this.setOrderedToSit(true); + this.level().broadcastEntityEvent(this, (byte) 7); +@@ -443,35 +425,31 @@ + return InteractionResult.CONSUME; + } + +- interactionresult = super.mobInteract(player, interactionhand); +- if (interactionresult.consumesAction()) { ++ enuminteractionresult = super.mobInteract(player, hand); ++ if (enuminteractionresult.consumesAction()) { + this.setPersistenceRequired(); + } + +- return interactionresult; ++ return enuminteractionresult; + } + } + + @Override +- @Override +- public boolean isFood(ItemStack itemstack) { +- return Cat.TEMPT_INGREDIENT.test(itemstack); ++ public boolean isFood(ItemStack stack) { ++ return Cat.TEMPT_INGREDIENT.test(stack); + } + + @Override +- @Override +- protected float getStandingEyeHeight(Pose pose, EntityDimensions entitydimensions) { +- return entitydimensions.height * 0.5F; ++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) { ++ return size.height * 0.5F; + } + + @Override +- @Override +- public boolean removeWhenFarAway(double d0) { ++ public boolean removeWhenFarAway(double distanceToClosestPlayer) { + return !this.isTame() && this.tickCount > 2400; + } + + @Override +- @Override + protected void reassessTameGoals() { + if (this.avoidPlayersGoal == null) { + this.avoidPlayersGoal = new Cat.CatAvoidEntityGoal<>(this, Player.class, 16.0F, 0.8D, 1.33D); +@@ -485,30 +463,27 @@ + } + + @Override +- @Override + public boolean isSteppingCarefully() { + return this.isCrouching() || super.isSteppingCarefully(); + } + + @Override +- @Override +- protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitydimensions, float f) { +- return new Vector3f(0.0F, entitydimensions.height - 0.1875F * f, 0.0F); ++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) { ++ return new Vector3f(0.0F, entitysize.height - 0.1875F * f, 0.0F); + } + + private static class CatTemptGoal extends TemptGoal { + + @Nullable +- private Player selectedPlayer; ++ private LivingEntity selectedPlayer; // CraftBukkit + private final Cat cat; + +- public CatTemptGoal(Cat cat, double d0, Ingredient ingredient, boolean flag) { +- super(cat, d0, ingredient, flag); ++ public CatTemptGoal(Cat cat, double speedModifier, Ingredient recipeitemstack, boolean items) { ++ super(cat, speedModifier, recipeitemstack, items); + this.cat = cat; + } + + @Override +- @Override + public void tick() { + super.tick(); + if (this.selectedPlayer == null && this.mob.getRandom().nextInt(this.adjustedTickDelay(600)) == 0) { +@@ -520,13 +495,11 @@ + } + + @Override +- @Override + protected boolean canScare() { + return this.selectedPlayer != null && this.selectedPlayer.equals(this.player) ? false : super.canScare(); + } + + @Override +- @Override + public boolean canUse() { + return super.canUse() && !this.cat.isTame(); + } +@@ -546,18 +519,17 @@ + } + + @Override +- @Override + public boolean canUse() { + if (!this.cat.isTame()) { + return false; + } else if (this.cat.isOrderedToSit()) { + return false; + } else { +- LivingEntity livingentity = this.cat.getOwner(); ++ LivingEntity entityliving = this.cat.getOwner(); + +- if (livingentity instanceof Player) { +- this.ownerPlayer = (Player) livingentity; +- if (!livingentity.isSleeping()) { ++ if (entityliving instanceof Player) { ++ this.ownerPlayer = (Player) entityliving; ++ if (!entityliving.isSleeping()) { + return false; + } + +@@ -565,14 +537,14 @@ + return false; + } + +- BlockPos blockpos = this.ownerPlayer.blockPosition(); +- BlockState blockstate = this.cat.level().getBlockState(blockpos); ++ BlockPos blockposition = this.ownerPlayer.blockPosition(); ++ IBlockData iblockdata = this.cat.level().getBlockState(blockposition); + +- if (blockstate.is(BlockTags.BEDS)) { +- this.goalPos = (BlockPos) blockstate.getOptionalValue(BedBlock.FACING).map((direction) -> { +- return blockpos.relative(direction.getOpposite()); ++ if (iblockdata.is(BlockTags.BEDS)) { ++ this.goalPos = (BlockPos) iblockdata.getOptionalValue(BedBlock.FACING).map((enumdirection) -> { ++ return blockposition.relative(enumdirection.getOpposite()); + }).orElseGet(() -> { +- return new BlockPos(blockpos); ++ return new BlockPos(blockposition); + }); + return !this.spaceIsOccupied(); + } +@@ -586,7 +558,7 @@ + List<Cat> list = this.cat.level().getEntitiesOfClass(Cat.class, (new AABB(this.goalPos)).inflate(2.0D)); + Iterator iterator = list.iterator(); + +- Cat cat; ++ Cat entitycat; + + do { + do { +@@ -594,21 +566,19 @@ + return false; + } + +- cat = (Cat) iterator.next(); +- } while (cat == this.cat); +- } while (!cat.isLying() && !cat.isRelaxStateOne()); ++ entitycat = (Cat) iterator.next(); ++ } while (entitycat == this.cat); ++ } while (!entitycat.isLying() && !entitycat.isRelaxStateOne()); + + return true; + } + + @Override +- @Override + public boolean canContinueToUse() { + return this.cat.isTame() && !this.cat.isOrderedToSit() && this.ownerPlayer != null && this.ownerPlayer.isSleeping() && this.goalPos != null && !this.spaceIsOccupied(); + } + + @Override +- @Override + public void start() { + if (this.goalPos != null) { + this.cat.setInSittingPose(false); +@@ -618,7 +588,6 @@ + } + + @Override +- @Override + public void stop() { + this.cat.setLying(false); + float f = this.cat.level().getTimeOfDay(1.0F); +@@ -634,11 +603,11 @@ + + private void giveMorningGift() { + RandomSource randomsource = this.cat.getRandom(); +- BlockPos.MutableBlockPos blockpos_mutableblockpos = new BlockPos.MutableBlockPos(); ++ BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); + +- blockpos_mutableblockpos.set(this.cat.isLeashed() ? this.cat.getLeashHolder().blockPosition() : this.cat.blockPosition()); +- this.cat.randomTeleport((double) (blockpos_mutableblockpos.getX() + randomsource.nextInt(11) - 5), (double) (blockpos_mutableblockpos.getY() + randomsource.nextInt(5) - 2), (double) (blockpos_mutableblockpos.getZ() + randomsource.nextInt(11) - 5), false); +- blockpos_mutableblockpos.set(this.cat.blockPosition()); ++ blockposition_mutableblockposition.set(this.cat.isLeashed() ? this.cat.getLeashHolder().blockPosition() : this.cat.blockPosition()); ++ this.cat.randomTeleport((double) (blockposition_mutableblockposition.getX() + randomsource.nextInt(11) - 5), (double) (blockposition_mutableblockposition.getY() + randomsource.nextInt(5) - 2), (double) (blockposition_mutableblockposition.getZ() + randomsource.nextInt(11) - 5), false); ++ blockposition_mutableblockposition.set(this.cat.blockPosition()); + LootTable loottable = this.cat.level().getServer().getLootData().getLootTable(BuiltInLootTables.CAT_MORNING_GIFT); + LootParams lootparams = (new LootParams.Builder((ServerLevel) this.cat.level())).withParameter(LootContextParams.ORIGIN, this.cat.position()).withParameter(LootContextParams.THIS_ENTITY, this.cat).create(LootContextParamSets.GIFT); + List<ItemStack> list = loottable.getRandomItems(lootparams); +@@ -647,13 +616,20 @@ + while (iterator.hasNext()) { + ItemStack itemstack = (ItemStack) iterator.next(); + +- this.cat.level().addFreshEntity(new ItemEntity(this.cat.level(), (double) blockpos_mutableblockpos.getX() - (double) Mth.sin(this.cat.yBodyRot * 0.017453292F), (double) blockpos_mutableblockpos.getY(), (double) blockpos_mutableblockpos.getZ() + (double) Mth.cos(this.cat.yBodyRot * 0.017453292F), itemstack)); ++ // CraftBukkit start ++ ItemEntity entityitem = new ItemEntity(this.cat.level(), (double) blockposition_mutableblockposition.getX() - (double) Mth.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) Mth.cos(this.cat.yBodyRot * 0.017453292F), itemstack); ++ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.cat.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity()); ++ entityitem.level().getCraftServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ continue; ++ } ++ this.cat.level().addFreshEntity(entityitem); ++ // CraftBukkit end + } + + } + + @Override +- @Override + public void tick() { + if (this.ownerPlayer != null && this.goalPos != null) { + this.cat.setInSittingPose(false); +@@ -679,22 +655,20 @@ + + private final Cat cat; + +- public CatAvoidEntityGoal(Cat cat, Class<T> oclass, float f, double d0, double d1) { +- Predicate predicate = EntitySelector.NO_CREATIVE_OR_SPECTATOR; ++ public CatAvoidEntityGoal(Cat cat, Class<T> entityClassToAvoid, float maxDist, double walkSpeedModifier, double d1) { ++ // Predicate predicate = IEntitySelector.NO_CREATIVE_OR_SPECTATOR; // CraftBukkit - decompile error + +- Objects.requireNonNull(predicate); +- super(cat, oclass, f, d0, d1, predicate::test); ++ // Objects.requireNonNull(predicate); // CraftBukkit - decompile error ++ super(cat, entityClassToAvoid, maxDist, walkSpeedModifier, d1, EntitySelector.NO_CREATIVE_OR_SPECTATOR::test); // CraftBukkit - decompile error + this.cat = cat; + } + + @Override +- @Override + public boolean canUse() { + return !this.cat.isTame() && super.canUse(); + } + + @Override +- @Override + public boolean canContinueToUse() { + return !this.cat.isTame() && super.canContinueToUse(); + } |