aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/entity/NeutralMob.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/NeutralMob.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/entity/NeutralMob.java.patch86
1 files changed, 86 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/NeutralMob.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/NeutralMob.java.patch
new file mode 100644
index 0000000000..35220dcb91
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/NeutralMob.java.patch
@@ -0,0 +1,86 @@
+--- a/net/minecraft/world/entity/NeutralMob.java
++++ b/net/minecraft/world/entity/NeutralMob.java
+@@ -25,21 +25,21 @@
+
+ void startPersistentAngerTimer();
+
+- default void addPersistentAngerSaveData(CompoundTag compoundtag) {
+- compoundtag.putInt("AngerTime", this.getRemainingPersistentAngerTime());
++ default void addPersistentAngerSaveData(CompoundTag nbt) {
++ nbt.putInt("AngerTime", this.getRemainingPersistentAngerTime());
+ if (this.getPersistentAngerTarget() != null) {
+- compoundtag.putUUID("AngryAt", this.getPersistentAngerTarget());
++ nbt.putUUID("AngryAt", this.getPersistentAngerTarget());
+ }
+
+ }
+
+- default void readPersistentAngerSaveData(Level level, CompoundTag compoundtag) {
+- this.setRemainingPersistentAngerTime(compoundtag.getInt("AngerTime"));
++ default void readPersistentAngerSaveData(Level level, CompoundTag tag) {
++ this.setRemainingPersistentAngerTime(tag.getInt("AngerTime"));
+ if (level instanceof ServerLevel) {
+- if (!compoundtag.hasUUID("AngryAt")) {
++ if (!tag.hasUUID("AngryAt")) {
+ this.setPersistentAngerTarget((UUID) null);
+ } else {
+- UUID uuid = compoundtag.getUUID("AngryAt");
++ UUID uuid = tag.getUUID("AngryAt");
+
+ this.setPersistentAngerTarget(uuid);
+ Entity entity = ((ServerLevel) level).getEntity(uuid);
+@@ -58,19 +58,19 @@
+ }
+ }
+
+- default void updatePersistentAnger(ServerLevel serverlevel, boolean flag) {
+- LivingEntity livingentity = this.getTarget();
++ default void updatePersistentAnger(ServerLevel serverLevel, boolean updateAnger) {
++ LivingEntity entityliving = this.getTarget();
+ UUID uuid = this.getPersistentAngerTarget();
+
+- if ((livingentity == null || livingentity.isDeadOrDying()) && uuid != null && serverlevel.getEntity(uuid) instanceof Mob) {
++ if ((entityliving == null || entityliving.isDeadOrDying()) && uuid != null && serverLevel.getEntity(uuid) instanceof Mob) {
+ this.stopBeingAngry();
+ } else {
+- if (livingentity != null && !Objects.equals(uuid, livingentity.getUUID())) {
+- this.setPersistentAngerTarget(livingentity.getUUID());
++ if (entityliving != null && !Objects.equals(uuid, entityliving.getUUID())) {
++ this.setPersistentAngerTarget(entityliving.getUUID());
+ this.startPersistentAngerTimer();
+ }
+
+- if (this.getRemainingPersistentAngerTime() > 0 && (livingentity == null || livingentity.getType() != EntityType.PLAYER || !flag)) {
++ if (this.getRemainingPersistentAngerTime() > 0 && (entityliving == null || entityliving.getType() != EntityType.PLAYER || !updateAnger)) {
+ this.setRemainingPersistentAngerTime(this.getRemainingPersistentAngerTime() - 1);
+ if (this.getRemainingPersistentAngerTime() == 0) {
+ this.stopBeingAngry();
+@@ -80,8 +80,8 @@
+ }
+ }
+
+- default boolean isAngryAt(LivingEntity livingentity) {
+- return !this.canAttack(livingentity) ? false : (livingentity.getType() == EntityType.PLAYER && this.isAngryAtAllPlayers(livingentity.level()) ? true : livingentity.getUUID().equals(this.getPersistentAngerTarget()));
++ default boolean isAngryAt(LivingEntity target) {
++ return !this.canAttack(target) ? false : (target.getType() == EntityType.PLAYER && this.isAngryAtAllPlayers(target.level()) ? true : target.getUUID().equals(this.getPersistentAngerTarget()));
+ }
+
+ default boolean isAngryAtAllPlayers(Level level) {
+@@ -108,7 +108,7 @@
+ default void stopBeingAngry() {
+ this.setLastHurtByMob((LivingEntity) null);
+ this.setPersistentAngerTarget((UUID) null);
+- this.setTarget((LivingEntity) null);
++ this.setTarget((LivingEntity) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
+ this.setRemainingPersistentAngerTime(0);
+ }
+
+@@ -121,6 +121,8 @@
+
+ void setTarget(@Nullable LivingEntity livingEntity);
+
++ boolean setTarget(@Nullable LivingEntity entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent); // CraftBukkit
++
+ boolean canAttack(LivingEntity entity);
+
+ @Nullable