mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Add PufferFishStateChangeEvent
This commit is contained in:
parent
75225eb102
commit
37143dae29
1 changed files with 42 additions and 2 deletions
|
@ -1,6 +1,46 @@
|
|||
--- a/net/minecraft/world/entity/animal/Pufferfish.java
|
||||
+++ b/net/minecraft/world/entity/animal/Pufferfish.java
|
||||
@@ -155,7 +155,7 @@
|
||||
@@ -102,25 +102,39 @@
|
||||
public void tick() {
|
||||
if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) {
|
||||
if (this.inflateCounter > 0) {
|
||||
+ boolean increase = true; // Paper - Add PufferFishStateChangeEvent
|
||||
if (this.getPuffState() == 0) {
|
||||
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 1).callEvent()) { // Paper - Add PufferFishStateChangeEvent
|
||||
this.makeSound(SoundEvents.PUFFER_FISH_BLOW_UP);
|
||||
this.setPuffState(1);
|
||||
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
|
||||
} else if (this.inflateCounter > 40 && this.getPuffState() == 1) {
|
||||
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 2).callEvent()) { // Paper - Add PufferFishStateChangeEvent
|
||||
this.makeSound(SoundEvents.PUFFER_FISH_BLOW_UP);
|
||||
this.setPuffState(2);
|
||||
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
|
||||
}
|
||||
|
||||
+ if (increase) { // Paper - Add PufferFishStateChangeEvent
|
||||
++this.inflateCounter;
|
||||
+ } // Paper - Add PufferFishStateChangeEvent
|
||||
} else if (this.getPuffState() != 0) {
|
||||
+ boolean increase = true; // Paper - Add PufferFishStateChangeEvent
|
||||
if (this.deflateTimer > 60 && this.getPuffState() == 2) {
|
||||
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 1).callEvent()) { // Paper - Add PufferFishStateChangeEvent
|
||||
this.makeSound(SoundEvents.PUFFER_FISH_BLOW_OUT);
|
||||
this.setPuffState(1);
|
||||
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
|
||||
} else if (this.deflateTimer > 100 && this.getPuffState() == 1) {
|
||||
+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 0).callEvent()) { // Paper - Add PufferFishStateChangeEvent
|
||||
this.makeSound(SoundEvents.PUFFER_FISH_BLOW_OUT);
|
||||
this.setPuffState(0);
|
||||
+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
|
||||
}
|
||||
|
||||
+ if (increase) { // Paper - Add PufferFishStateChangeEvent
|
||||
++this.deflateTimer;
|
||||
+ } // Paper - Add PufferFishStateChangeEvent
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +169,7 @@
|
||||
int i = this.getPuffState();
|
||||
|
||||
if (target.hurtServer(world, this.damageSources().mobAttack(this), (float) (1 + i))) {
|
||||
|
@ -9,7 +49,7 @@
|
|||
this.playSound(SoundEvents.PUFFER_FISH_STING, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
@@ -171,7 +185,7 @@
|
||||
entityplayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.PUFFER_FISH_STING, 0.0F));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue