Attempt to fix villager right clicks

This commit is contained in:
fullwall 2016-08-19 21:54:19 +08:00
parent d9f31ffc84
commit 41deaf2fd0
1 changed files with 14 additions and 1 deletions

View File

@ -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()) {