mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-10 17:31:26 +01:00
Fix villager interacting in 1.15
This commit is contained in:
parent
46b1ba6e98
commit
a6fbb31de6
@ -125,15 +125,6 @@ public class VillagerController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dY() {
|
||||
if (blockingATrade) {
|
||||
blockingATrade = false;
|
||||
return true;
|
||||
}
|
||||
return super.dY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
@ -156,6 +147,15 @@ public class VillagerController extends MobEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean et() {
|
||||
if (blockingATrade) {
|
||||
blockingATrade = false;
|
||||
return true;
|
||||
}
|
||||
return super.et();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(super.getBukkitEntity() instanceof NPCHolder)) {
|
||||
|
@ -121,15 +121,6 @@ public class WanderingTraderController extends MobEntityController {
|
||||
return npc == null ? super.d(save) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dY() {
|
||||
if (blockingATrade) {
|
||||
blockingATrade = false;
|
||||
return true;
|
||||
}
|
||||
return super.dY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e(Vec3D vec3d) {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
@ -153,25 +144,12 @@ public class WanderingTraderController extends MobEntityController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void h(double x, double y, double z) {
|
||||
if (npc == null) {
|
||||
super.h(x, y, z);
|
||||
return;
|
||||
public boolean et() {
|
||||
if (blockingATrade) {
|
||||
blockingATrade = false;
|
||||
return true;
|
||||
}
|
||||
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
|
||||
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true))
|
||||
super.h(x, y, z);
|
||||
return;
|
||||
}
|
||||
Vector vector = new Vector(x, y, z);
|
||||
NPCPushEvent event = Util.callPushEvent(npc, vector);
|
||||
if (!event.isCancelled()) {
|
||||
vector = event.getCollisionVector();
|
||||
super.h(vector.getX(), vector.getY(), vector.getZ());
|
||||
}
|
||||
// when another entity collides, this method is called to push the
|
||||
// NPC so we prevent it from doing anything if the event is
|
||||
// cancelled.
|
||||
return super.et();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -202,6 +180,28 @@ public class WanderingTraderController extends MobEntityController {
|
||||
return NMSImpl.getSoundEffect(npc, super.getSoundHurt(damagesource), NPC.HURT_SOUND_METADATA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void h(double x, double y, double z) {
|
||||
if (npc == null) {
|
||||
super.h(x, y, z);
|
||||
return;
|
||||
}
|
||||
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0) {
|
||||
if (!npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true))
|
||||
super.h(x, y, z);
|
||||
return;
|
||||
}
|
||||
Vector vector = new Vector(x, y, z);
|
||||
NPCPushEvent event = Util.callPushEvent(npc, vector);
|
||||
if (!event.isCancelled()) {
|
||||
vector = event.getCollisionVector();
|
||||
super.h(vector.getX(), vector.getY(), vector.getZ());
|
||||
}
|
||||
// when another entity collides, this method is called to push the
|
||||
// NPC so we prevent it from doing anything if the event is
|
||||
// cancelled.
|
||||
}
|
||||
|
||||
public boolean isBlockingTrades() {
|
||||
return blockTrades;
|
||||
}
|
||||
|
@ -137,9 +137,9 @@ public class PlayerAnimationImpl {
|
||||
NMSImpl.sendPacketNearby(player.getBukkitEntity(), player.getBukkitEntity().getLocation(), packet, radius);
|
||||
}
|
||||
|
||||
private static EnumMap<PlayerAnimation, Integer> DEFAULTS = Maps.newEnumMap(PlayerAnimation.class);
|
||||
private static final MethodHandle ENTITY_SETPOSE_METHOD = NMS.getMethodHandle(Entity.class, "setPose", true,
|
||||
EntityPose.class);
|
||||
private static EnumMap<PlayerAnimation, Integer> DEFAULTS = Maps.newEnumMap(PlayerAnimation.class);
|
||||
static {
|
||||
DEFAULTS.put(PlayerAnimation.ARM_SWING, 0);
|
||||
DEFAULTS.put(PlayerAnimation.HURT, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user