@Override protected boolean openGui(EntityPlayer player, World world, BlockPos pos) { player.openGui(TConstruct.instance, 0, world, pos.getX(), pos.getY(), pos.getZ()); return true; } }
@Override public boolean openGui(EntityPlayer player, World world, BlockPos pos) { player.openGui(TConstruct.instance, 0, world, pos.getX(), pos.getY(), pos.getZ()); if(player.openContainer instanceof BaseContainer) { ((BaseContainer) player.openContainer).syncOnOpen((EntityPlayerMP) player); } return true; }
@Override public boolean openGui(EntityPlayer player, World world, BlockPos pos) { if(!world.isRemote) { player.openGui(TConstruct.instance, 0, world, pos.getX(), pos.getY(), pos.getZ()); if(player.openContainer instanceof BaseContainer) { ((BaseContainer) player.openContainer).syncOnOpen((EntityPlayerMP) player); } } return true; }
@Nonnull @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) { player.openGui(Botania.instance, LibGuiIDs.BAUBLE_BOX, world, hand == EnumHand.OFF_HAND ? 1 : 0, 0, 0); return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); }
@Nonnull @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) { player.openGui(Botania.instance, LibGuiIDs.FLOWER_BAG, world, hand == EnumHand.OFF_HAND ? 1 : 0, 0, 0); return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); }
@Nonnull @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) { ItemStack stack = player.getHeldItem(hand); int segment = getSegmentLookedAt(stack, player); ItemStack itemForPos = getItemForSlot(stack, segment); if(segment == 0) player.openGui(Botania.instance, LibGuiIDs.CRAFTING_HALO, world, hand == EnumHand.OFF_HAND ? 1 : 0, 0, 0); else { if(itemForPos.isEmpty()) assignRecipe(stack, itemForPos, segment); else tryCraft(player, stack, segment, true, getFakeInv(player), true); } return ActionResult.newResult(EnumActionResult.SUCCESS, stack); }
public static void openBook(EntityPlayer player, ItemStack stack, World world, boolean skipSound) { ILexicon l = (ILexicon) stack.getItem(); Botania.proxy.setToTutorialIfFirstLaunch(); if(!l.isKnowledgeUnlocked(stack, BotaniaAPI.relicKnowledge) && l.isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge)) for(ItemStack rstack : ItemDice.relicStacks) { Item item = rstack.getItem(); if(PlayerHelper.hasItem(player, s -> s != null && s.getItem() == item)) { l.unlockKnowledge(stack, BotaniaAPI.relicKnowledge); break; } } Botania.proxy.setLexiconStack(stack); player.openGui(Botania.instance, LibGuiIDs.LEXICON, world, 0, 0, 0); if(!world.isRemote) { if(!skipSound) world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.lexiconOpen, SoundCategory.PLAYERS, 0.5F, 1F); UseItemSuccessTrigger.INSTANCE.trigger((EntityPlayerMP) player, stack, (WorldServer) world, player.posX, player.posY, player.posZ); } }
@Nonnull @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) { if (!world.isRemote) { player.openGui(PECore.instance, Constants.ALCH_BAG_GUI, world, hand.ordinal(), -1, -1); } return ActionResult.newResult(EnumActionResult.SUCCESS, player.getHeldItem(hand)); }
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { player.openGui(PECore.instance, Constants.TRANSMUTE_STONE_GUI, world, pos.getX(), pos.getY(), pos.getZ()); } return true; }
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { player.openGui(PECore.instance, Constants.CONDENSER_GUI, world, pos.getX(), pos.getY(), pos.getZ()); } return true; }
@Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { // Uses the gui handler registered to your mod to open the gui for the given gui id // open on the server side only (not sure why you shouldn't open client side too... vanilla doesn't, so we better not either) if (worldIn.isRemote) return true; playerIn.openGui(MinecraftByExample.instance, GuiHandlerMBE31.getGuiID(), worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; }
@Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { // Uses the gui handler registered to your mod to open the gui for the given gui id // open on the server side only (not sure why you shouldn't open client side too... vanilla doesn't, so we better not either) if (worldIn.isRemote) return true; playerIn.openGui(MinecraftByExample.instance, GuiHandlerMBE30.getGuiID(), worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; }
@Override public void onWrenchClicked(EntityPlayer entityplayer) { entityplayer.openGui(LogisticsPipes.instance, GuiIDs.GUI_Freq_Card_ID, getWorld(), getX(), getY(), getZ()); } }
@Override public void onKeyPressed(ItemStack stack, EntityPlayer player, KeyBindings key, boolean showInChat) { if (stack == player.getHeldItemMainhand() && stack.getItem() instanceof ItemSigilHolding && key.equals(KeyBindings.OPEN_HOLDING)) { Utils.setUUID(stack); player.openGui(BloodMagic.instance, Constants.Gui.SIGIL_HOLDING_GUI, player.getEntityWorld(), (int) player.posX, (int) player.posY, (int) player.posZ); } }
public static void openGui(EntityPlayer entityplayer, IGuiHandlerTile guiHandler, short data) { int guiData = encodeGuiData(guiHandler, data); BlockPos coordinates = guiHandler.getCoordinates(); entityplayer.openGui(ForestryAPI.instance, guiData, entityplayer.world, coordinates.getX(), coordinates.getY(), coordinates.getZ()); }
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(pos); if(feeder != null){ player.openGui(ActuallyAdditions.INSTANCE, GuiHandler.GuiTypes.FEEDER.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); } return true; } return true; }
@Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(worldIn.getTileEntity(pos) instanceof TileEntityEnchantmentTable) worldIn.setTileEntity(pos, createNewTileEntity(worldIn, 0)); playerIn.openGui(Quark.instance, LibGuiIDs.MATRIX_ENCHANTING, worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; }
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { if (player.getGameProfile().getId().equals(((TileSecurityManager) world.getTileEntity(pos)).getNode().getOwner())) { player.openGui(RS.INSTANCE, RSGui.SECURITY_MANAGER, world, pos.getX(), pos.getY(), pos.getZ()); } else { openNetworkGui(RSGui.SECURITY_MANAGER, player, world, pos, side, Permission.MODIFY, Permission.SECURITY); } } return true; }
@Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (!world.isRemote) { if (player.isSneaking()) { return new ActionResult<>(EnumActionResult.SUCCESS, new ItemStack(RSItems.FILTER)); } player.openGui(RS.INSTANCE, RSGui.FILTER, world, hand.ordinal(), 0, 0); return new ActionResult<>(EnumActionResult.SUCCESS, stack); } return new ActionResult<>(EnumActionResult.PASS, stack); }