diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Ocelot.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Ocelot.java.patch | 353 |
1 files changed, 353 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Ocelot.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Ocelot.java.patch new file mode 100644 index 0000000000..deaff815cc --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Ocelot.java.patch @@ -0,0 +1,353 @@ +--- a/net/minecraft/world/entity/animal/Ocelot.java ++++ b/net/minecraft/world/entity/animal/Ocelot.java +@@ -16,19 +16,19 @@ + import net.minecraft.tags.BlockTags; + 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.ai.attributes.AttributeSupplier; + import net.minecraft.world.entity.ai.attributes.Attributes; + import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; +@@ -49,7 +49,7 @@ + import net.minecraft.world.level.LevelReader; + import net.minecraft.world.level.ServerLevelAccessor; + import net.minecraft.world.level.block.Blocks; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.phys.Vec3; + import org.joml.Vector3f; + +@@ -65,43 +65,39 @@ + @Nullable + private Ocelot.OcelotTemptGoal temptGoal; + +- public Ocelot(EntityType<? extends Ocelot> entitytype, Level level) { +- super(entitytype, level); ++ public Ocelot(EntityType<? extends Ocelot> entityType, Level level) { ++ super(entityType, level); + this.reassessTrustingGoals(); + } + +- boolean isTrusting() { ++ public boolean isTrusting() { + return (Boolean) this.entityData.get(Ocelot.DATA_TRUSTING); + } + +- private void setTrusting(boolean flag) { +- this.entityData.set(Ocelot.DATA_TRUSTING, flag); ++ public void setTrusting(boolean trusting) { ++ this.entityData.set(Ocelot.DATA_TRUSTING, trusting); + this.reassessTrustingGoals(); + } + + @Override +- @Override +- public void addAdditionalSaveData(CompoundTag compoundtag) { +- super.addAdditionalSaveData(compoundtag); +- compoundtag.putBoolean("Trusting", this.isTrusting()); ++ public void addAdditionalSaveData(CompoundTag compound) { ++ super.addAdditionalSaveData(compound); ++ compound.putBoolean("Trusting", this.isTrusting()); + } + + @Override +- @Override +- public void readAdditionalSaveData(CompoundTag compoundtag) { +- super.readAdditionalSaveData(compoundtag); +- this.setTrusting(compoundtag.getBoolean("Trusting")); ++ public void readAdditionalSaveData(CompoundTag compound) { ++ super.readAdditionalSaveData(compound); ++ this.setTrusting(compound.getBoolean("Trusting")); + } + + @Override +- @Override + protected void defineSynchedData() { + super.defineSynchedData(); + this.entityData.define(Ocelot.DATA_TRUSTING, false); + } + + @Override +- @Override + protected void registerGoals() { + this.temptGoal = new Ocelot.OcelotTemptGoal(this, 0.6D, Ocelot.TEMPT_INGREDIENT, true); + this.goalSelector.addGoal(1, new FloatGoal(this)); +@@ -116,31 +112,29 @@ + } + + @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); + } + + } + + @Override +- @Override +- public boolean removeWhenFarAway(double d0) { ++ public boolean removeWhenFarAway(double distanceToClosestPlayer) { + return !this.isTrusting() && this.tickCount > 2400; + } + +@@ -150,25 +144,21 @@ + + @Nullable + @Override +- @Override + protected SoundEvent getAmbientSound() { + return SoundEvents.OCELOT_AMBIENT; + } + + @Override +- @Override + public int getAmbientSoundInterval() { + return 900; + } + + @Override +- @Override +- protected SoundEvent getHurtSound(DamageSource damagesource) { ++ protected SoundEvent getHurtSound(DamageSource damageSource) { + return SoundEvents.OCELOT_HURT; + } + + @Override +- @Override + protected SoundEvent getDeathSound() { + return SoundEvents.OCELOT_DEATH; + } +@@ -178,20 +168,18 @@ + } + + @Override +- @Override + public boolean doHurtTarget(Entity entity) { + return entity.hurt(this.damageSources().mobAttack(this), this.getAttackDamage()); + } + + @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); + + if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && player.distanceToSqr((Entity) this) < 9.0D) { +- this.usePlayerItem(player, interactionhand, itemstack); ++ this.usePlayerItem(player, hand, itemstack); + if (!this.level().isClientSide) { +- if (this.random.nextInt(3) == 0) { ++ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit - added event call and isCancelled check + this.setTrusting(true); + this.spawnTrustingParticles(true); + this.level().broadcastEntityEvent(this, (byte) 41); +@@ -203,28 +191,27 @@ + + return InteractionResult.sidedSuccess(this.level().isClientSide); + } else { +- return super.mobInteract(player, interactionhand); ++ return super.mobInteract(player, hand); + } + } + + @Override +- @Override +- public void handleEntityEvent(byte b0) { +- if (b0 == 41) { ++ public void handleEntityEvent(byte id) { ++ if (id == 41) { + this.spawnTrustingParticles(true); +- } else if (b0 == 40) { ++ } else if (id == 40) { + this.spawnTrustingParticles(false); + } else { +- super.handleEntityEvent(b0); ++ super.handleEntityEvent(id); + } + + } + +- private void spawnTrustingParticles(boolean flag) { +- SimpleParticleType simpleparticletype = ParticleTypes.HEART; ++ private void spawnTrustingParticles(boolean isTrusted) { ++ SimpleParticleType particletype = ParticleTypes.HEART; + +- if (!flag) { +- simpleparticletype = ParticleTypes.SMOKE; ++ if (!isTrusted) { ++ particletype = ParticleTypes.SMOKE; + } + + for (int i = 0; i < 7; ++i) { +@@ -232,7 +219,7 @@ + double d1 = this.random.nextGaussian() * 0.02D; + double d2 = this.random.nextGaussian() * 0.02D; + +- this.level().addParticle(simpleparticletype, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), d0, d1, d2); ++ this.level().addParticle(particletype, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), d0, d1, d2); + } + + } +@@ -251,34 +238,31 @@ + + @Nullable + @Override +- @Override +- public Ocelot getBreedOffspring(ServerLevel serverlevel, AgeableMob ageablemob) { +- return (Ocelot) EntityType.OCELOT.create(serverlevel); ++ public Ocelot getBreedOffspring(ServerLevel level, AgeableMob otherParent) { ++ return (Ocelot) EntityType.OCELOT.create(level); + } + + @Override +- @Override +- public boolean isFood(ItemStack itemstack) { +- return Ocelot.TEMPT_INGREDIENT.test(itemstack); ++ public boolean isFood(ItemStack stack) { ++ return Ocelot.TEMPT_INGREDIENT.test(stack); + } + +- public static boolean checkOcelotSpawnRules(EntityType<Ocelot> entitytype, LevelAccessor levelaccessor, MobSpawnType mobspawntype, BlockPos blockpos, RandomSource randomsource) { +- return randomsource.nextInt(3) != 0; ++ public static boolean checkOcelotSpawnRules(EntityType<Ocelot> ocelot, LevelAccessor level, EnumMobSpawn spawnType, BlockPos pos, RandomSource random) { ++ return random.nextInt(3) != 0; + } + + @Override +- @Override +- public boolean checkSpawnObstruction(LevelReader levelreader) { +- if (levelreader.isUnobstructed(this) && !levelreader.containsAnyLiquid(this.getBoundingBox())) { +- BlockPos blockpos = this.blockPosition(); ++ public boolean checkSpawnObstruction(LevelReader level) { ++ if (level.isUnobstructed(this) && !level.containsAnyLiquid(this.getBoundingBox())) { ++ BlockPos blockposition = this.blockPosition(); + +- if (blockpos.getY() < levelreader.getSeaLevel()) { ++ if (blockposition.getY() < level.getSeaLevel()) { + return false; + } + +- BlockState blockstate = levelreader.getBlockState(blockpos.below()); ++ IBlockData iblockdata = level.getBlockState(blockposition.below()); + +- if (blockstate.is(Blocks.GRASS_BLOCK) || blockstate.is(BlockTags.LEAVES)) { ++ if (iblockdata.is(Blocks.GRASS_BLOCK) || iblockdata.is(BlockTags.LEAVES)) { + return true; + } + } +@@ -288,44 +272,39 @@ + + @Nullable + @Override +- @Override +- public SpawnGroupData finalizeSpawn(ServerLevelAccessor serverlevelaccessor, DifficultyInstance difficultyinstance, MobSpawnType mobspawntype, @Nullable SpawnGroupData spawngroupdata, @Nullable CompoundTag compoundtag) { +- if (spawngroupdata == null) { +- spawngroupdata = new AgeableMob.AgeableMobGroupData(1.0F); ++ public GroupDataEntity finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EnumMobSpawn reason, @Nullable GroupDataEntity spawnData, @Nullable CompoundTag dataTag) { ++ if (spawnData == null) { ++ spawnData = new AgeableMob.AgeableMobGroupData(1.0F); + } + +- return super.finalizeSpawn(serverlevelaccessor, difficultyinstance, mobspawntype, (SpawnGroupData) spawngroupdata, compoundtag); ++ return super.finalizeSpawn(level, difficulty, reason, (GroupDataEntity) spawnData, dataTag); + } + + @Override +- @Override + public Vec3 getLeashOffset() { + return new Vec3(0.0D, (double) (0.5F * this.getEyeHeight()), (double) (this.getBbWidth() * 0.4F)); + } + + @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.0625F * f, 0.0F); ++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) { ++ return new Vector3f(0.0F, entitysize.height - 0.0625F * f, 0.0F); + } + + private static class OcelotTemptGoal extends TemptGoal { + + private final Ocelot ocelot; + +- public OcelotTemptGoal(Ocelot ocelot, double d0, Ingredient ingredient, boolean flag) { +- super(ocelot, d0, ingredient, flag); ++ public OcelotTemptGoal(Ocelot ocelot, double speedModifier, Ingredient recipeitemstack, boolean items) { ++ super(ocelot, speedModifier, recipeitemstack, items); + this.ocelot = ocelot; + } + + @Override +- @Override + protected boolean canScare() { + return super.canScare() && !this.ocelot.isTrusting(); + } +@@ -335,22 +314,20 @@ + + private final Ocelot ocelot; + +- public OcelotAvoidEntityGoal(Ocelot ocelot, Class<T> oclass, float f, double d0, double d1) { +- Predicate predicate = EntitySelector.NO_CREATIVE_OR_SPECTATOR; ++ public OcelotAvoidEntityGoal(Ocelot ocelot, Class<T> entityClassToAvoid, float maxDist, double walkSpeedModifier, double d1) { ++ // Predicate predicate = IEntitySelector.NO_CREATIVE_OR_SPECTATOR; // CraftBukkit - decompile error + +- Objects.requireNonNull(predicate); +- super(ocelot, oclass, f, d0, d1, predicate::test); ++ // Objects.requireNonNull(predicate); // CraftBukkit - decompile error ++ super(ocelot, entityClassToAvoid, maxDist, walkSpeedModifier, d1, EntitySelector.NO_CREATIVE_OR_SPECTATOR::test); // CraftBukkit - decompile error + this.ocelot = ocelot; + } + + @Override +- @Override + public boolean canUse() { + return !this.ocelot.isTrusting() && super.canUse(); + } + + @Override +- @Override + public boolean canContinueToUse() { + return !this.ocelot.isTrusting() && super.canContinueToUse(); + } |