public static ITextComponent formChatComponent(Object... chats) { ITextComponent chat = getChatComponent(chats[0]); for (int i = 1, chatsLength = chats.length; i < chatsLength; i++) { chat.appendSibling(getChatComponent(chats[i])); } return chat; }
@Override @SideOnly (Side.CLIENT) public void handleClientSide(EntityPlayer player) { String string = getString(); int offset = getInt(); CoFHCore.proxy.addIndexedChatMessage(ChatHelper.fromJSON(string), offset); }
public PacketIndexedChat(ITextComponent chat, int index) { addString(ChatHelper.toJSON(chat)); addInt(index); }
@Override public void onModeChange(EntityPlayer player, ItemStack stack) { player.world.playSound(null, player.getPosition(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.4F, 0.8F + 0.4F * getMode(stack)); ChatHelper.sendIndexedChatMessageToPlayer(player, new TextComponentTranslation("info.thermalexpansion.satchel.c." + getMode(stack))); }
ChatHelper.sendIndexedChatMessagesToPlayer(player, info); info.clear(); return true; if (tile instanceof ITileInfo) { ((ITileInfo) tile).getTileInfo(info, side, player, false); ChatHelper.sendIndexedChatMessagesToPlayer(player, info); info.clear(); return true;
@Override public void onModeChange(EntityPlayer player, ItemStack stack) { player.world.playSound(null, player.getPosition(), SoundEvents.BLOCK_LEVER_CLICK, SoundCategory.PLAYERS, 0.4F, (isActive(stack) ? 0.7F : 0.5F) + 0.1F * getMode(stack)); ChatHelper.sendIndexedChatMessageToPlayer(player, new TextComponentTranslation("info.thermalexpansion.capacitor.d." + getMode(stack))); }
@Override public void onModeChange(EntityPlayer player, ItemStack stack) { switch (getMode(stack)) { case BUCKET_FILL: player.world.playSound(null, player.getPosition(), SoundEvents.ITEM_BUCKET_FILL, SoundCategory.PLAYERS, 0.6F, 1.0F); break; case BUCKET_EMPTY: player.world.playSound(null, player.getPosition(), SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.PLAYERS, 0.6F, 1.0F); break; } ChatHelper.sendIndexedChatMessageToPlayer(player, new TextComponentTranslation("info.thermalexpansion.reservoir.d." + getMode(stack))); }
protected final void addInfo(List<ITextComponent> info, String type, Object value) { info.add(new TextComponentTranslation("info.thermaldynamics.info." + type).appendText(": ").appendSibling(ChatHelper.getChatComponent(value))); }
ChatHelper.sendIndexedChatMessageToPlayer(player, new TextComponentTranslation("chat.thermalfoundation.augment.install.success")); } else { ChatHelper.sendIndexedChatMessageToPlayer(player, new TextComponentTranslation("chat.thermalfoundation.augment.install.failure"));
private boolean doLockUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos) { if (ServerHelper.isClientWorld(world)) { return false; } TileEntity tile = world.getTileEntity(pos); if (tile instanceof ISecurable) { if (((ISecurable) tile).setOwner(player.getGameProfile())) { ((ISecurable) tile).setAccess(AccessMode.PUBLIC); if (!player.capabilities.isCreativeMode) { stack.shrink(1); } player.world.playSound(null, player.getPosition(), SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.PLAYERS, 0.5F, 0.8F); ChatHelper.sendIndexedChatMessageToPlayer(player, new TextComponentTranslation("chat.cofh.secure.block.success")); } return true; } return false; }
ChatHelper.sendIndexedChatMessageToPlayer(player, new TextComponentTranslation("chat.thermalfoundation.upgrade.install.success")); } else { ChatHelper.sendIndexedChatMessageToPlayer(player, new TextComponentTranslation("chat.thermalfoundation.upgrade.install.failure"));
@Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (CoreUtils.isFakePlayer(player) || hand != EnumHand.MAIN_HAND) { return new ActionResult<>(EnumActionResult.FAIL, stack); } if (needsTag(stack)) { setDefaultInventoryTag(stack); } if (ServerHelper.isServerWorld(world)) { if (SecurityHelper.isSecure(stack) && SecurityHelper.isDefaultUUID(SecurityHelper.getOwner(stack).getId())) { SecurityHelper.setOwner(stack, player.getGameProfile()); ChatHelper.sendIndexedChatMessageToPlayer(player, new TextComponentTranslation("chat.cofh.secure.item.success")); return new ActionResult<>(EnumActionResult.SUCCESS, stack); } if (canPlayerAccess(stack, player)) { if (player.isSneaking() && ItemHelper.getItemDamage(stack) != CREATIVE) { player.openGui(ThermalExpansion.instance, GuiHandler.SATCHEL_FILTER_ID, world, 0, 0, 0); } else { player.openGui(ThermalExpansion.instance, GuiHandler.SATCHEL_ID, world, 0, 0, 0); } } else if (SecurityHelper.isSecure(stack)) { ChatHelper.sendIndexedChatMessageToPlayer(player, new TextComponentTranslation("chat.cofh.secure.warning", SecurityHelper.getOwnerName(stack))); return new ActionResult<>(EnumActionResult.FAIL, stack); } } return new ActionResult<>(EnumActionResult.SUCCESS, stack); }