use of net.minecraft.util.text.IFormattableTextComponent in project AgriCraft by AgriCraft.
the class SeedBagScrollHandler method tryCycleSortMode.
public boolean tryCycleSortMode(Hand hand, int delta) {
ItemStack stack = this.getPlayer().getHeldItem(hand);
if (stack.getItem() instanceof ItemSeedBag) {
ItemSeedBag bag = (ItemSeedBag) stack.getItem();
if (bag.incrementSorter(stack, delta)) {
new MessageSyncSeedBagSortMode(hand, bag.getContents(stack).getSorterIndex()).sendToServer();
SeedBagShakeHandler.getInstance().shake(hand);
ItemSeedBag.Contents contents = bag.getContents(stack);
IFormattableTextComponent message = new StringTextComponent("").appendSibling(contents.getSorter().describe()).appendSibling(new StringTextComponent(", ")).appendSibling(AgriToolTips.MSG_SEED_BAG_SHAKE);
if (contents.getCount() <= 0) {
message.appendSibling(new StringTextComponent(" ")).appendSibling(AgriToolTips.MSG_SEED_BAG_EMPTY);
}
AgriCraft.instance.getClientPlayer().sendMessage(message, Util.DUMMY_UUID);
return true;
}
}
return false;
}
Aggregations