diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Pufferfish.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Pufferfish.java.patch | 232 |
1 files changed, 232 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Pufferfish.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Pufferfish.java.patch new file mode 100644 index 0000000000..b99f78dc65 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/animal/Pufferfish.java.patch @@ -0,0 +1,232 @@ +--- a/net/minecraft/world/entity/animal/Pufferfish.java ++++ b/net/minecraft/world/entity/animal/Pufferfish.java +@@ -15,11 +15,11 @@ + import net.minecraft.world.effect.MobEffectInstance; + import net.minecraft.world.effect.MobEffects; + import net.minecraft.world.entity.EntityDimensions; ++import net.minecraft.world.entity.EntityPose; + import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.EnumMonsterType; + import net.minecraft.world.entity.LivingEntity; + import net.minecraft.world.entity.Mob; +-import net.minecraft.world.entity.MobType; +-import net.minecraft.world.entity.Pose; + import net.minecraft.world.entity.ai.goal.Goal; + import net.minecraft.world.entity.ai.targeting.TargetingConditions; + import net.minecraft.world.entity.player.Player; +@@ -32,21 +32,20 @@ + private static final EntityDataAccessor<Integer> PUFF_STATE = SynchedEntityData.defineId(Pufferfish.class, EntityDataSerializers.INT); + int inflateCounter; + int deflateTimer; +- private static final Predicate<LivingEntity> SCARY_MOB = (livingentity) -> { +- return livingentity instanceof Player && ((Player) livingentity).isCreative() ? false : livingentity.getType() == EntityType.AXOLOTL || livingentity.getMobType() != MobType.WATER; ++ private static final Predicate<LivingEntity> SCARY_MOB = (entityliving) -> { ++ return entityliving instanceof Player && ((Player) entityliving).isCreative() ? false : entityliving.getType() == EntityType.AXOLOTL || entityliving.getMobType() != EnumMonsterType.WATER; + }; + static final TargetingConditions targetingConditions = TargetingConditions.forNonCombat().ignoreInvisibilityTesting().ignoreLineOfSight().selector(Pufferfish.SCARY_MOB); + public static final int STATE_SMALL = 0; + public static final int STATE_MID = 1; + public static final int STATE_FULL = 2; + +- public Pufferfish(EntityType<? extends Pufferfish> entitytype, Level level) { +- super(entitytype, level); ++ public Pufferfish(EntityType<? extends Pufferfish> entityType, Level level) { ++ super(entityType, level); + this.refreshDimensions(); + } + + @Override +- @Override + protected void defineSynchedData() { + super.defineSynchedData(); + this.entityData.define(Pufferfish.PUFF_STATE, 0); +@@ -56,49 +55,43 @@ + return (Integer) this.entityData.get(Pufferfish.PUFF_STATE); + } + +- public void setPuffState(int i) { +- this.entityData.set(Pufferfish.PUFF_STATE, i); ++ public void setPuffState(int puffState) { ++ this.entityData.set(Pufferfish.PUFF_STATE, puffState); + } + + @Override +- @Override +- public void onSyncedDataUpdated(EntityDataAccessor<?> entitydataaccessor) { +- if (Pufferfish.PUFF_STATE.equals(entitydataaccessor)) { ++ public void onSyncedDataUpdated(EntityDataAccessor<?> key) { ++ if (Pufferfish.PUFF_STATE.equals(key)) { + this.refreshDimensions(); + } + +- super.onSyncedDataUpdated(entitydataaccessor); ++ super.onSyncedDataUpdated(key); + } + + @Override +- @Override +- public void addAdditionalSaveData(CompoundTag compoundtag) { +- super.addAdditionalSaveData(compoundtag); +- compoundtag.putInt("PuffState", this.getPuffState()); ++ public void addAdditionalSaveData(CompoundTag compound) { ++ super.addAdditionalSaveData(compound); ++ compound.putInt("PuffState", this.getPuffState()); + } + + @Override +- @Override +- public void readAdditionalSaveData(CompoundTag compoundtag) { +- super.readAdditionalSaveData(compoundtag); +- this.setPuffState(Math.min(compoundtag.getInt("PuffState"), 2)); ++ public void readAdditionalSaveData(CompoundTag compound) { ++ super.readAdditionalSaveData(compound); ++ this.setPuffState(Math.min(compound.getInt("PuffState"), 2)); + } + + @Override +- @Override + public ItemStack getBucketItemStack() { + return new ItemStack(Items.PUFFERFISH_BUCKET); + } + + @Override +- @Override + protected void registerGoals() { + super.registerGoals(); + this.goalSelector.addGoal(1, new Pufferfish.PufferfishPuffGoal(this)); + } + + @Override +- @Override + public void tick() { + if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) { + if (this.inflateCounter > 0) { +@@ -128,20 +121,19 @@ + } + + @Override +- @Override + public void aiStep() { + super.aiStep(); + if (this.isAlive() && this.getPuffState() > 0) { +- List<Mob> list = this.level().getEntitiesOfClass(Mob.class, this.getBoundingBox().inflate(0.3D), (mob) -> { +- return Pufferfish.targetingConditions.test(this, mob); ++ List<Mob> list = this.level().getEntitiesOfClass(Mob.class, this.getBoundingBox().inflate(0.3D), (entityinsentient) -> { ++ return Pufferfish.targetingConditions.test(this, entityinsentient); + }); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { +- Mob mob = (Mob) iterator.next(); ++ Mob entityinsentient = (Mob) iterator.next(); + +- if (mob.isAlive()) { +- this.touch(mob); ++ if (entityinsentient.isAlive()) { ++ this.touch(entityinsentient); + } + } + } +@@ -152,59 +144,53 @@ + int i = this.getPuffState(); + + if (mob.hurt(this.damageSources().mobAttack(this), (float) (1 + i))) { +- mob.addEffect(new MobEffectInstance(MobEffects.POISON, 60 * i, 0), this); ++ mob.addEffect(new MobEffectInstance(MobEffects.POISON, 60 * i, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit + this.playSound(SoundEvents.PUFFER_FISH_STING, 1.0F, 1.0F); + } + + } + + @Override +- @Override +- public void playerTouch(Player player) { ++ public void playerTouch(Player entity) { + int i = this.getPuffState(); + +- if (player instanceof ServerPlayer && i > 0 && player.hurt(this.damageSources().mobAttack(this), (float) (1 + i))) { ++ if (entity instanceof ServerPlayer && i > 0 && entity.hurt(this.damageSources().mobAttack(this), (float) (1 + i))) { + if (!this.isSilent()) { +- ((ServerPlayer) player).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.PUFFER_FISH_STING, 0.0F)); ++ ((ServerPlayer) entity).connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.PUFFER_FISH_STING, 0.0F)); + } + +- player.addEffect(new MobEffectInstance(MobEffects.POISON, 60 * i, 0), this); ++ entity.addEffect(new MobEffectInstance(MobEffects.POISON, 60 * i, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit + } + + } + + @Override +- @Override + protected SoundEvent getAmbientSound() { + return SoundEvents.PUFFER_FISH_AMBIENT; + } + + @Override +- @Override + protected SoundEvent getDeathSound() { + return SoundEvents.PUFFER_FISH_DEATH; + } + + @Override +- @Override +- protected SoundEvent getHurtSound(DamageSource damagesource) { ++ protected SoundEvent getHurtSound(DamageSource damageSource) { + return SoundEvents.PUFFER_FISH_HURT; + } + + @Override +- @Override + protected SoundEvent getFlopSound() { + return SoundEvents.PUFFER_FISH_FLOP; + } + + @Override +- @Override +- public EntityDimensions getDimensions(Pose pose) { ++ public EntityDimensions getDimensions(EntityPose pose) { + return super.getDimensions(pose).scale(getScale(this.getPuffState())); + } + +- private static float getScale(int i) { +- switch (i) { ++ private static float getScale(int puffState) { ++ switch (puffState) { + case 0: + return 0.5F; + case 1: +@@ -218,29 +204,26 @@ + + private final Pufferfish fish; + +- public PufferfishPuffGoal(Pufferfish pufferfish) { +- this.fish = pufferfish; ++ public PufferfishPuffGoal(Pufferfish fish) { ++ this.fish = fish; + } + + @Override +- @Override + public boolean canUse() { +- List<LivingEntity> list = this.fish.level().getEntitiesOfClass(LivingEntity.class, this.fish.getBoundingBox().inflate(2.0D), (livingentity) -> { +- return Pufferfish.targetingConditions.test(this.fish, livingentity); ++ List<LivingEntity> list = this.fish.level().getEntitiesOfClass(LivingEntity.class, this.fish.getBoundingBox().inflate(2.0D), (entityliving) -> { ++ return Pufferfish.targetingConditions.test(this.fish, entityliving); + }); + + return !list.isEmpty(); + } + + @Override +- @Override + public void start() { + this.fish.inflateCounter = 1; + this.fish.deflateTimer = 0; + } + + @Override +- @Override + public void stop() { + this.fish.inflateCounter = 0; + } |