From 41deaf2fd0e314c11d462f88a34d45f834bec813 Mon Sep 17 00:00:00 2001 From: fullwall Date: Fri, 19 Aug 2016 21:54:19 +0800 Subject: [PATCH] Attempt to fix villager right clicks --- .../nms/v1_10_R1/entity/VillagerController.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/VillagerController.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/VillagerController.java index e8b6c6351..33a69c32e 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/VillagerController.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/entity/VillagerController.java @@ -36,6 +36,7 @@ public class VillagerController extends MobEntityController { } public static class EntityVillagerNPC extends EntityVillager implements NPCHolder { + private boolean blockingATrade; private boolean blockTrades = true; private final CitizensNPC npc; @@ -71,7 +72,10 @@ public class VillagerController extends MobEntityController { @Override public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) { - return npc == null || !blockTrades ? super.a(entityhuman) : false; // block trades + if (npc != null && blockTrades) { + blockingATrade = true; + } + return super.a(entityhuman, enumhand, itemstack); } @Override @@ -99,6 +103,15 @@ public class VillagerController extends MobEntityController { return npc == null ? super.d(save) : false; } + @Override + public boolean dh() { + if (blockingATrade) { + blockingATrade = false; + return true; + } + return super.dh(); + } + @Override public void e(float f, float f1) { if (npc == null || !npc.isFlyable()) {