aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/entity/NeutralMob.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/NeutralMob.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/entity/NeutralMob.java.patch105
1 files changed, 105 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/NeutralMob.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/NeutralMob.java.patch
new file mode 100644
index 0000000000..9af1f21b52
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/NeutralMob.java.patch
@@ -0,0 +1,105 @@
+--- a/net/minecraft/world/entity/NeutralMob.java
++++ b/net/minecraft/world/entity/NeutralMob.java
+@@ -10,6 +10,7 @@
+ import net.minecraft.world.level.Level;
+
+ public interface NeutralMob {
++
+ String TAG_ANGER_TIME = "AngerTime";
+ String TAG_ANGRY_AT = "AngryAt";
+
+@@ -29,53 +30,58 @@
+ if (this.getPersistentAngerTarget() != null) {
+ nbt.putUUID("AngryAt", this.getPersistentAngerTarget());
+ }
++
+ }
+
+ default void readPersistentAngerSaveData(Level level, CompoundTag tag) {
+ this.setRemainingPersistentAngerTime(tag.getInt("AngerTime"));
+ if (level instanceof ServerLevel) {
+ if (!tag.hasUUID("AngryAt")) {
+- this.setPersistentAngerTarget(null);
++ this.setPersistentAngerTarget((UUID) null);
+ } else {
+- UUID uUID = tag.getUUID("AngryAt");
+- this.setPersistentAngerTarget(uUID);
+- Entity entity = ((ServerLevel)level).getEntity(uUID);
++ UUID uuid = tag.getUUID("AngryAt");
++
++ this.setPersistentAngerTarget(uuid);
++ Entity entity = ((ServerLevel) level).getEntity(uuid);
++
+ if (entity != null) {
+ if (entity instanceof Mob) {
+- this.setLastHurtByMob((Mob)entity);
++ this.setLastHurtByMob((Mob) entity);
+ }
+
+ if (entity.getType() == EntityType.PLAYER) {
+- this.setLastHurtByPlayer((Player)entity);
++ this.setLastHurtByPlayer((Player) entity);
+ }
++
+ }
+ }
+ }
+ }
+
+ default void updatePersistentAnger(ServerLevel serverLevel, boolean updateAnger) {
+- LivingEntity target = this.getTarget();
+- UUID persistentAngerTarget = this.getPersistentAngerTarget();
+- if ((target == null || target.isDeadOrDying()) && persistentAngerTarget != null && serverLevel.getEntity(persistentAngerTarget) instanceof Mob) {
++ LivingEntity entityliving = this.getTarget();
++ UUID uuid = this.getPersistentAngerTarget();
++
++ if ((entityliving == null || entityliving.isDeadOrDying()) && uuid != null && serverLevel.getEntity(uuid) instanceof Mob) {
+ this.stopBeingAngry();
+ } else {
+- if (target != null && !Objects.equals(persistentAngerTarget, target.getUUID())) {
+- this.setPersistentAngerTarget(target.getUUID());
++ if (entityliving != null && !Objects.equals(uuid, entityliving.getUUID())) {
++ this.setPersistentAngerTarget(entityliving.getUUID());
+ this.startPersistentAngerTimer();
+ }
+
+- if (this.getRemainingPersistentAngerTime() > 0 && (target == null || target.getType() != EntityType.PLAYER || !updateAnger)) {
++ if (this.getRemainingPersistentAngerTime() > 0 && (entityliving == null || entityliving.getType() != EntityType.PLAYER || !updateAnger)) {
+ this.setRemainingPersistentAngerTime(this.getRemainingPersistentAngerTime() - 1);
+ if (this.getRemainingPersistentAngerTime() == 0) {
+ this.stopBeingAngry();
+ }
+ }
++
+ }
+ }
+
+ default boolean isAngryAt(LivingEntity target) {
+- return this.canAttack(target)
+- && (target.getType() == EntityType.PLAYER && this.isAngryAtAllPlayers(target.level()) || target.getUUID().equals(this.getPersistentAngerTarget()));
++ return !this.canAttack(target) ? false : (target.getType() == EntityType.PLAYER && this.isAngryAtAllPlayers(target.level()) ? true : target.getUUID().equals(this.getPersistentAngerTarget()));
+ }
+
+ default boolean isAngryAtAllPlayers(Level level) {
+@@ -100,9 +106,9 @@
+ }
+
+ default void stopBeingAngry() {
+- this.setLastHurtByMob(null);
+- this.setPersistentAngerTarget(null);
+- this.setTarget(null);
++ this.setLastHurtByMob((LivingEntity) null);
++ this.setPersistentAngerTarget((UUID) null);
++ this.setTarget((LivingEntity) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
+ this.setRemainingPersistentAngerTime(0);
+ }
+
+@@ -115,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