use of xyz.przemyk.simpleplanes.entities.LargePlaneEntity in project simple-planes by przemykomo.
the class CommonEventHandler method interact.
@SubscribeEvent
public static void interact(PlayerInteractEvent.RightClickItem event) {
Player player = event.getPlayer();
Entity entity = player.getRootVehicle();
if (entity instanceof PlaneEntity) {
ItemStack itemStack = player.getItemInHand(event.getHand());
if (!itemStack.isEmpty()) {
if (itemStack.getItem() == Items.TNT && entity instanceof LargePlaneEntity && ((LargePlaneEntity) entity).tryToAddTNT(player, itemStack)) {
return;
}
PlaneEntity planeEntity = (PlaneEntity) entity;
for (Upgrade upgrade : planeEntity.upgrades.values()) {
upgrade.onItemRightClick(event);
}
}
}
}
Aggregations