From fa4ea79606fef867265d750d95e51d627a3f1dd0 Mon Sep 17 00:00:00 2001 From: fullwall Date: Mon, 9 Sep 2024 17:05:45 +0800 Subject: [PATCH] Set hover in place to true for parrot npcs --- .../citizensnpcs/nms/v1_15_R1/entity/ParrotController.java | 4 ++++ .../citizensnpcs/nms/v1_16_R3/entity/ParrotController.java | 4 ++++ .../citizensnpcs/nms/v1_17_R1/entity/ParrotController.java | 4 ++++ .../citizensnpcs/nms/v1_18_R2/entity/ParrotController.java | 4 ++++ .../citizensnpcs/nms/v1_19_R3/entity/ParrotController.java | 4 ++++ .../main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java | 1 + .../citizensnpcs/nms/v1_20_R4/entity/ParrotController.java | 4 ++++ .../citizensnpcs/nms/v1_21_R1/entity/ParrotController.java | 4 ++++ 8 files changed, 29 insertions(+) diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ParrotController.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ParrotController.java index 8e9b4fbf1..f4dc4a077 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ParrotController.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/entity/ParrotController.java @@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.Util; import net.minecraft.server.v1_15_R1.AxisAlignedBB; +import net.minecraft.server.v1_15_R1.ControllerMoveFlying; import net.minecraft.server.v1_15_R1.DamageSource; import net.minecraft.server.v1_15_R1.Entity; import net.minecraft.server.v1_15_R1.EntityBoat; @@ -53,6 +54,9 @@ public class ParrotController extends MobEntityController { public EntityParrotNPC(EntityTypes types, World world, NPC npc) { super(types, world); this.npc = (CitizensNPC) npc; + if (npc != null) { + this.moveController = new ControllerMoveFlying(this, 10, true); + } } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ParrotController.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ParrotController.java index 4ed835e4f..6280c3595 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ParrotController.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/entity/ParrotController.java @@ -16,6 +16,7 @@ import net.citizensnpcs.npc.ai.NPCHolder; import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.Util; import net.minecraft.server.v1_16_R3.AxisAlignedBB; +import net.minecraft.server.v1_16_R3.ControllerMoveFlying; import net.minecraft.server.v1_16_R3.DamageSource; import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R3.EntityBoat; @@ -54,6 +55,9 @@ public class ParrotController extends MobEntityController { public EntityParrotNPC(EntityTypes types, World world, NPC npc) { super(types, world); this.npc = (CitizensNPC) npc; + if (npc != null) { + this.moveController = new ControllerMoveFlying(this, 10, true); + } } @Override diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/ParrotController.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/ParrotController.java index e9b69fce1..b21a46350 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/ParrotController.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/entity/ParrotController.java @@ -23,6 +23,7 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.control.FlyingMoveControl; import net.minecraft.world.entity.animal.Parrot; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.AbstractMinecart; @@ -53,6 +54,9 @@ public class ParrotController extends MobEntityController { public EntityParrotNPC(EntityType types, Level level, NPC npc) { super(types, level); this.npc = (CitizensNPC) npc; + if (npc != null) { + this.moveControl = new FlyingMoveControl(this, 10, true); + } } @Override diff --git a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/entity/ParrotController.java b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/entity/ParrotController.java index a2141899c..b7e9291ce 100644 --- a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/entity/ParrotController.java +++ b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/entity/ParrotController.java @@ -25,6 +25,7 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.control.FlyingMoveControl; import net.minecraft.world.entity.animal.Parrot; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.AbstractMinecart; @@ -55,6 +56,9 @@ public class ParrotController extends MobEntityController { public EntityParrotNPC(EntityType types, Level level, NPC npc) { super(types, level); this.npc = (CitizensNPC) npc; + if (npc != null) { + this.moveControl = new FlyingMoveControl(this, 10, true); + } } @Override diff --git a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/entity/ParrotController.java b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/entity/ParrotController.java index 56556d618..51e1d9232 100644 --- a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/entity/ParrotController.java +++ b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/entity/ParrotController.java @@ -25,6 +25,7 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.control.FlyingMoveControl; import net.minecraft.world.entity.animal.Parrot; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.AbstractMinecart; @@ -55,6 +56,9 @@ public class ParrotController extends MobEntityController { public EntityParrotNPC(EntityType types, Level level, NPC npc) { super(types, level); this.npc = (CitizensNPC) npc; + if (npc != null) { + this.moveControl = new FlyingMoveControl(this, 10, true); + } } @Override diff --git a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java index ca4739123..4e32426a8 100644 --- a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java +++ b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java @@ -2541,6 +2541,7 @@ public class NMSImpl implements NMSBridge { } private static final MethodHandle ATTRIBUTE_PROVIDER_MAP = NMS.getFirstGetter(AttributeSupplier.class, Map.class); + private static final MethodHandle ATTRIBUTE_PROVIDER_MAP_SETTER = NMS.getFirstFinalSetter(AttributeSupplier.class, Map.class); private static final MethodHandle ATTRIBUTE_SUPPLIER = NMS.getFirstGetter(AttributeMap.class, diff --git a/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/ParrotController.java b/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/ParrotController.java index ac23f0bc5..dd45d8e09 100644 --- a/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/ParrotController.java +++ b/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/ParrotController.java @@ -23,6 +23,7 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.control.FlyingMoveControl; import net.minecraft.world.entity.animal.Parrot; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.AbstractMinecart; @@ -53,6 +54,9 @@ public class ParrotController extends MobEntityController { public EntityParrotNPC(EntityType types, Level level, NPC npc) { super(types, level); this.npc = (CitizensNPC) npc; + if (npc != null) { + this.moveControl = new FlyingMoveControl(this, 10, true); + } } @Override diff --git a/v1_21_R1/src/main/java/net/citizensnpcs/nms/v1_21_R1/entity/ParrotController.java b/v1_21_R1/src/main/java/net/citizensnpcs/nms/v1_21_R1/entity/ParrotController.java index e3949c010..dc1561b4b 100644 --- a/v1_21_R1/src/main/java/net/citizensnpcs/nms/v1_21_R1/entity/ParrotController.java +++ b/v1_21_R1/src/main/java/net/citizensnpcs/nms/v1_21_R1/entity/ParrotController.java @@ -22,6 +22,7 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.control.FlyingMoveControl; import net.minecraft.world.entity.animal.Parrot; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.AbstractMinecart; @@ -53,6 +54,9 @@ public class ParrotController extends MobEntityController { public EntityParrotNPC(EntityType types, Level level, NPC npc) { super(types, level); this.npc = (CitizensNPC) npc; + if (npc != null) { + this.moveControl = new FlyingMoveControl(this, 10, true); + } } @Override