- Статус
- Оффлайн
- Регистрация
- 3 Май 2023
- Сообщения
- 854
- Реакции
- 19
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Java:
@SubscribeEvent
public void onMiddleClick(InputEvent.MouseInputEvent event) {
if (event.getButton() == 2 && event.getAction() == 1) {
Minecraft mc = Minecraft.getInstance();
PlayerEntity player = mc.player;
if (player == null) return;
int hotbarSlot = player.inventory.selected;
int pearlSlot = -1;
for (int i = 0; i < 36; i++) {
if (player.inventory.getItem(i).getItem() == Items.ENDER_PEARL) {
pearlSlot = i;
break;
}
}
if (pearlSlot != -1 && pearlSlot != hotbarSlot) {
player.inventory.selected = pearlSlot;
player.inventory.setChanged();
mc.gameMode.useItem(player, mc.level, Hand.MAIN_HAND);
player.inventory.selected = hotbarSlot;
player.inventory.setChanged();
} else if (pearlSlot == -1) {
ChatUtil.addGradientChatMessage("YouGame Client", TextFormatting.GRAY + " > " + TextFormatting.RED + "Эндер пёрлы не найдены.");
}
}
}
