mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 12:15:53 +01:00
Attempt to fix villager right clicks
This commit is contained in:
parent
d9f31ffc84
commit
41deaf2fd0
@ -36,6 +36,7 @@ public class VillagerController extends MobEntityController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
|
public static class EntityVillagerNPC extends EntityVillager implements NPCHolder {
|
||||||
|
private boolean blockingATrade;
|
||||||
private boolean blockTrades = true;
|
private boolean blockTrades = true;
|
||||||
private final CitizensNPC npc;
|
private final CitizensNPC npc;
|
||||||
|
|
||||||
@ -71,7 +72,10 @@ public class VillagerController extends MobEntityController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean a(EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack) {
|
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
|
@Override
|
||||||
@ -99,6 +103,15 @@ public class VillagerController extends MobEntityController {
|
|||||||
return npc == null ? super.d(save) : false;
|
return npc == null ? super.d(save) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dh() {
|
||||||
|
if (blockingATrade) {
|
||||||
|
blockingATrade = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.dh();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void e(float f, float f1) {
|
public void e(float f, float f1) {
|
||||||
if (npc == null || !npc.isFlyable()) {
|
if (npc == null || !npc.isFlyable()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user