@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!world.isRemote) switch (tier) { case 1: player.openGui(MozeCore.instance, Constants.relayMK1GUI, world, x, y, z); break; case 2: player.openGui(MozeCore.instance, Constants.relayMK2GUI, world, x, y, z); break; case 3: player.openGui(MozeCore.instance, Constants.relayMK3GUI, world, x, y, z); break; } return true; }
/** Called when the block is right clicked by the player */ @Override public boolean onMachineActivated( World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) { int metadata = par1World.getBlockMetadata(x, y, z); if (!par1World.isRemote) { if (metadata >= GCCoreBlockMachine.COMPRESSOR_METADATA) { par5EntityPlayer.openGui(GalacticraftCore.instance, -1, par1World, x, y, z); return true; } else if (metadata >= GCCoreBlockMachine.ELECTRIC_FURNACE_METADATA) { par5EntityPlayer.openGui(GalacticraftCore.instance, -1, par1World, x, y, z); return true; } else if (metadata >= GCCoreBlockMachine.STORAGE_MODULE_METADATA) { par5EntityPlayer.openGui(GalacticraftCore.instance, -1, par1World, x, y, z); return true; } else { par5EntityPlayer.openGui(GalacticraftCore.instance, -1, par1World, x, y, z); return true; } } return true; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { AbstractInvExpander expander = (AbstractInvExpander) world.getTileEntity(x, y, z); TurretBase base = expander.getBase(); if (base != null && base.getTrustedPlayer(player.getUniqueID()) != null) { if (base.getTrustedPlayer(player.getUniqueID()).canOpenGUI) { player.openGui(ModularTurrets.instance, 7, world, x, y, z); return true; } } if (base != null && player.getUniqueID().toString().equals(base.getOwner())) { player.openGui(ModularTurrets.instance, 7, world, x, y, z); } else { player.addChatMessage( new ChatComponentText(StatCollector.translateToLocal("status.ownership"))); } return true; }
@SubscribeEvent public void onPlayerInteract0(PlayerInteractEvent event) { if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { World world = event.world; EntityPlayer player = event.entityPlayer; int x = event.x; int y = event.y; int z = event.z; if (world == null || world.isRemote) return; if (player.isSneaking()) return; if (EtFuturum.enableEnchants) { TileEntityEnchantmentTable tile = Utils.getTileEntity(world, x, y, z, TileEntityEnchantmentTable.class); if (tile != null && world.getBlock(x, y, z) == Blocks.enchanting_table) { player.openGui(EtFuturum.instance, GUIsID.ENCHANTING_TABLE, world, x, y, z); event.setCanceled(true); return; } } if (EtFuturum.enableAnvil) if (world.getBlock(x, y, z) == Blocks.anvil) { player.openGui(EtFuturum.instance, GUIsID.ANVIL, world, x, y, z); event.setCanceled(true); return; } } }
@Override public boolean onItemUse( ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { if (!player.canPlayerEdit(x, y, z, side, itemStack)) return false; UseTrowelEvent event = new UseTrowelEvent(player, itemStack, world, x, y, z); if (MinecraftForge.EVENT_BUS.post(event)) return false; if (event.getResult() == Event.Result.ALLOW) { itemStack.damageItem(1, player); return true; } if (side == 0) return false; Block block = world.getBlock(x, y, z); if (block instanceof BlockGarden) { player.openGui(GardenCore.instance, GuiHandler.gardenLayoutGuiID, world, x, y, z); return true; } else if (block instanceof IPlantProxy) { IPlantProxy proxy = (IPlantProxy) block; TileEntityGarden te = proxy.getGardenEntity(world, x, y, z); if (te != null) { player.openGui( GardenCore.instance, GuiHandler.gardenLayoutGuiID, world, te.xCoord, te.yCoord, te.zCoord); return true; } } /*if (world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && (block == Blocks.grass || block == Blocks.dirt)) { Block.SoundType stepSound = ModBlocks.gardenSoil.stepSound; world.playSoundEffect( + .5f, y + .5f, z + .5f, stepSound.getStepResourcePath(), (stepSound.getVolume() + .5f) / 2, stepSound.getPitch() * .8f); if (!world.isRemote) { world.setBlock(x, y, z, ModBlocks.gardenSoil); itemStack.damageItem(1, player); } return true; }*/ return false; }
@Override public void openGui(EntityPlayer player, TileBase tile) { if (isLinked()) player.openGui( ForestryAPI.instance, GuiId.TraderGUI.ordinal(), worldObj, xCoord, yCoord, zCoord); else player.openGui( ForestryAPI.instance, GuiId.TraderNameGUI.ordinal(), worldObj, xCoord, yCoord, zCoord); }
public boolean onBlockActivated( World par1World, BlockPos pos, IBlockState state, EntityPlayer par5EntityPlayer, EnumFacing side, float par7, float par8, float par9) { if (!par1World.isRemote) { if (par5EntityPlayer.getCurrentEquippedItem() == null || (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().getItem() != mod_SecurityCraft.Codebreaker)) { TileEntityKeypadFurnace TE = (TileEntityKeypadFurnace) par1World.getTileEntity(pos); if (TE.getPassword() != null && !TE.getPassword().isEmpty()) { par5EntityPlayer.openGui( mod_SecurityCraft.instance, GuiHandler.INSERT_PASSWORD_ID, par1World, pos.getX(), pos.getY(), pos.getZ()); } else { par5EntityPlayer.openGui( mod_SecurityCraft.instance, GuiHandler.SETUP_PASSWORD_ID, par1World, pos.getX(), pos.getY(), pos.getZ()); } } else { if (mod_SecurityCraft.instance.configHandler.allowCodebreakerItem) { if (((IPasswordProtected) par1World.getTileEntity(pos)).getPassword() != null) { activate(par1World, pos, par5EntityPlayer); } } else { PlayerUtils.sendMessageToPlayer( par5EntityPlayer, StatCollector.translateToLocal("tile.keypadFurnace.name"), StatCollector.translateToLocal("messages.codebreakerDisabled"), EnumChatFormatting.RED); } } } return true; }
/** Called upon block activation (right click on the block.) */ public boolean onBlockActivated( World var1, int var2, int var3, int var4, EntityPlayer var5, int var6, float var7, float var8, float var9) { if (var1.isRemote) { return true; } else if (var5.isSneaking()) { return false; } else { FF_TileEntityMetalFurnace var10 = (FF_TileEntityMetalFurnace) var1.getBlockTileEntity(var2, var3, var4); if (var10 != null) { var5.openGui(MetallurgyFantasy.instance, 0, var1, var2, var3, var4); } return true; } }
@Override public boolean blockActivated(EntityPlayer entityplayer) { Item equipped = entityplayer.getCurrentEquippedItem() != null ? entityplayer.getCurrentEquippedItem().getItem() : null; if (equipped instanceof IToolWrench && ((IToolWrench) equipped) .canWrench(entityplayer, container.xCoord, container.yCoord, container.zCoord)) { ((PipeTransportAdvancedWood) transport).switchSource(); ((IToolWrench) equipped) .wrenchUsed(entityplayer, container.xCoord, container.yCoord, container.zCoord); return true; } if (AdditionalPipes.isPipe(equipped)) { return false; } entityplayer.openGui( AdditionalPipes.instance, GuiHandler.PIPE_WOODEN_ADV, container.worldObj, container.xCoord, container.yCoord, container.zCoord); return true; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (!world.isRemote) { TileEntityElementalTinkeringAltar tile = (TileEntityElementalTinkeringAltar) world.getBlockTileEntity(x, y, z); if (tile != null) { player.openGui( ElementalTinkerer.instance, GuiIDs.ID_ELEMENTALIST_TINKERING_ALTAR, world, x, y, z); PlayerResearch research = ResearchHelper.getResearchDataForPlayer(player.username); if (research.isResearchCompleted(ResearchReference.ID_ELEMENTIUM_INGOT)) ResearchHelper.formulateResearchNode( ResearchReference.ID_CATALYST_CAPSULE, player, ResearchReference.CATEGORY_NAME_PURE); } } return true; }
@Override public void onNetworkHandlerEvent(int key, String value) { if ((key == 103) && (this.remote != null) && (getRemoteGUIinRange())) { EntityPlayer player = this.worldObj.getPlayerEntityByName(value); if (player != null) { player.openGui( ModularForceFieldSystem.instance, 0, this.worldObj, this.remote.xCoord, this.remote.yCoord, this.remote.zCoord); } } if ((key == 102) && (this.remote != null)) { this.remote.onSwitch(); } if ((key == 101) && (this.remote != null)) { this.remote.toogleSwitchMode(); } super.onNetworkHandlerEvent(key, value); }
public ItemStack onItemRightClick( ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (par2World.isRemote) { par3EntityPlayer.openGui(MrCrayfishFurnitureMod.instance, 10, par2World, 0, 0, 0); } return par1ItemStack; }
/** Called when the blocks is activated. We are using it to open our GUI */ @Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (!player.isSneaking()) { DummyTile us = (DummyTile) world.getTileEntity(x, y, z); if (us.getCore() != null) player.openGui( Bookshelf.instance, 0, world, us.getCore().xCoord, us.getCore().yCoord, us.getCore().zCoord); return true; } return true; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (player.isSneaking()) { return false; } if (world.getTileEntity(x, y, z) != null && ((TileEntityControler) world.getTileEntity(x, y, z)).getMultiblockController() != null && ((TileEntityControler) world.getTileEntity(x, y, z)) .getMultiblockController() .isAssembled()) { player.openGui(ZettaIndustries.instance, 3, world, x, y, z); return true; } return false; }
/** Called upon block activation (right click on the block.) */ @Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { if (player.isSneaking()) { player.openGui(FullPower.instance, GuiHandler.GuiIDs.CAMO_MINE.ordinal(), world, x, y, z); } TileEntityCamoMine te = (TileEntityCamoMine) world.getTileEntity(x, y, z); if (te.getCamouflage(side) != null) { ItemStack camoStack = te.getCamouflage(side); te.setCamouflage(null, side); EntityItem itemEntity = new EntityItem(world, x, y, z, camoStack); LogHelper.info("StackSize=" + camoStack.stackSize); // Tell world this item needs to be spawned world.spawnEntityInWorld(itemEntity); } else { ItemStack playerItem = player.getCurrentEquippedItem(); if (playerItem != null) { ItemStack camoStack = playerItem.splitStack(1); // Remove 1 from stack ChatHelper.send(camoStack.toString()); te.setCamouflage(camoStack, side); } } } return true; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { ItemStack item = player.inventory.getCurrentItem(); TileEntity tileentity = world.getTileEntity(x, y, z); OrderExchanger tile = null; if (tileentity != null && tileentity instanceof OrderExchanger) { tile = (OrderExchanger) tileentity; } if (tile != null && tile.canHandleMP(player)) { if (world.isRemote) { return true; } else { player.openGui(EcoMTCore.instance, EcoMTCore.instance.guiOrder, world, x, y, z); return true; } } return true; }
public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { if (entityPlayer.isSneaking()) entityPlayer.openGui( ShadowCraftEvolved.instance, IDs.GuiIDs.Land_Mine.ordinal(), world, x, y, z); TileEntityLandMineMk3 te = (TileEntityLandMineMk3) world.getTileEntity(x, y, z); if (te.getCamouflage(side) != null) { ItemStack camoStack = te.getCamouflage(side); te.setCamouflage(null, side); EntityItem itemEntity = new EntityItem(world, x, y, z, camoStack); world.spawnEntityInWorld(itemEntity); } else { ItemStack playerItem = entityPlayer.getCurrentEquippedItem(); if (playerItem != null) { ItemStack camoStack = playerItem.splitStack(1); te.setCamouflage(camoStack, side); } } } return true; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float par7, float par8, float par9) { if (ConduitUtil.isToolEquipped(entityPlayer)) { if (entityPlayer.isSneaking() && entityPlayer.getCurrentEquippedItem().getItem() instanceof IToolWrench) { IToolWrench wrench = (IToolWrench) entityPlayer.getCurrentEquippedItem().getItem(); if (wrench.canWrench(entityPlayer, x, y, z)) { removedByPlayer(world, entityPlayer, x, y, z, false); if (entityPlayer.getCurrentEquippedItem().getItem() instanceof IToolWrench) { ((IToolWrench) entityPlayer.getCurrentEquippedItem().getItem()) .wrenchUsed(entityPlayer, x, y, z); } return true; } } } if (entityPlayer.isSneaking()) { return false; } entityPlayer.openGui(EnderIO.instance, GuiHandler.GUI_ID_ENCHANTER, world, x, y, z); return true; }
/** Called upon block activation (right click on the block.) */ @Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { TEHopper te = getHopperTE(world, x, y, z); if (world.isRemote) { if (te != null && te.pressBlock != null && player.isSneaking()) { te.pressBlock = null; te.pressCooldown = 0; } return true; } else { if (te != null && te.pressCooldown == 0) { player.openGui(TerraFirmaCraft.instance, 49, world, x, y, z); } else if (te != null && te.pressBlock != null && player.isSneaking()) { TFC_Core.giveItemToPlayer(te.pressBlock, player); te.pressBlock = null; te.pressCooldown = 0; } return true; } }
@SideOnly(Side.CLIENT) /** * When this method is called, your block should register all the icons it needs with the given * IconRegister. This is the only chance you get to register icons. */ /** Called upon block activation (right click on the block.) */ public boolean onBlockActivated( World par1World, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { TileEntity tileentity = par1World.getBlockTileEntity(x, y, z); if (tileentity == null || player.isSneaking()) { return false; } player.openGui(VgTutorial.instance, 0, par1World, x, y, z); return true; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer entityplayer, int side, float hitX, float hitY, float hitZ) { super.onBlockActivated(world, x, y, z, entityplayer, side, hitX, hitY, hitZ); TileEntityQuern te = (TileEntityQuern) world.getBlockTileEntity(x, y, z); if (!world.isRemote) { if (!te.shouldRotate && hitX >= 0.65 && hitZ >= 0.65 && te.storage[2] != null) { te.shouldRotate = true; world.playSoundEffect(x, y, z, TFC_Sounds.STONEDRAG, 1, 1); } else if ((!te.shouldRotate && (hitX < 0.65 || hitZ < 0.65)) || te.storage[2] == null) { entityplayer.openGui(TerraFirmaCraft.instance, 33, world, x, y, z); } } else if (!te.shouldRotate && hitX >= 0.65 && hitZ >= 0.65 && te.hasQuern) { te.shouldRotate = true; } return true; }
/** * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a * pig. */ @Override public boolean interact(EntityPlayer var1) { ItemStack itemstack = var1.inventory.getCurrentItem(); boolean flag = itemstack != null && itemstack.itemID == Item.monsterPlacer.itemID; if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) { if (!this.worldObj.isRemote) { this.setCustomer(var1); var1.openGui(DivineRPG.instance, GuiHandler.LEORNA, worldObj, entityId, entityId, entityId); } switch (this.rand.nextInt(5)) { case 0: var1.addChatMessage( "Leorna: Could you imagine if the whole world was covered in plants?"); break; case 1: var1.addChatMessage("Leorna: Embracing nature is part of the importance of life."); break; case 2: var1.addChatMessage( "Leorna: Have you tried throwing Lomonas? They are mighty handy for finding my way."); break; case 3: var1.addChatMessage("Leorna: Hitchak sure is tasty. "); break; case 4: var1.addChatMessage("Leorna: Zelus won't stop looking at me."); break; } return true; } else return super.interact(var1); }
public void drawScreen(int par1, int par2, float par3) { super.drawScreen(par1, par2, par3); boolean op = false; // TODO: Check if player is OP if (Keyboard.isKeyDown(Keyboard.KEY_O) && op) { player.openGui(ModUncrafting.instance, 1, worldObj, x, y, z); } }
/** Called upon block activation (right click on the block.) */ public boolean onBlockActivated( World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { if (par1World.isRemote) { return true; } else { TileEntity var10 = par1World.getBlockTileEntity(par2, par3, par4); if (var10 == null || par5EntityPlayer.isSneaking()) { return false; } if (var10 != null && var10 instanceof TileEntityMysticFurnace) { par5EntityPlayer.openGui(MysticAdditions.instance, 0, par1World, par2, par3, par4); } return true; } }
public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (player.isSneaking()) return false; TileEntityLimekiln tileEntity = (TileEntityLimekiln) world.getBlockTileEntity(x, y, z); if (tileEntity != null) { if (tileEntity.facing != ForgeDirection.getOrientation(par6).getOpposite()) { tileEntity.facing = ForgeDirection.getOrientation(par6).getOpposite(); } if (!tileEntity.getIsValid()) { if (tileEntity.checkIfProperlyFormed()) { tileEntity.convertDummies(); } } // Check if the multi-block structure has been formed. if (tileEntity.getIsValid()) player.openGui(ConcreteCore.instance, ConfigHandler.GUIIDs.limekiln, world, x, y, z); } return true; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity != null && tileEntity instanceof TileVendor) { TileVendor tileVendor = (TileVendor) world.getTileEntity(x, y, z); EntityPlayer playerTest = world.getPlayerEntityByName(tileVendor.playerName); if (playerTest == null || !tileVendor.isUseableByPlayer(playerTest)) { tileVendor.inUse = false; } ; if (tileVendor.inUse && !player.getDisplayName().contentEquals(tileVendor.playerName)) { if (!world.isRemote) { player.addChatMessage( new ChatComponentText(StatCollector.translateToLocal("chat.warning.inuse"))); } return true; } else { player.openGui(UniversalCoins.instance, 0, world, x, y, z); tileVendor.playerName = player.getDisplayName(); tileVendor.inUse = true; tileVendor.updateCoinsForPurchase(); return true; } } return false; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) { ItemStack playerItem = player.getCurrentEquippedItem(); if (playerItem != null) { if (playerItem.getItem() instanceof TelepositionFocus) { SoulNetworkHandler.checkAndSetItemPlayer(playerItem, player); if (playerItem.getTagCompound() == null) { playerItem.setTagCompound(new NBTTagCompound()); } NBTTagCompound itemTag = playerItem.getTagCompound(); itemTag.setInteger("xCoord", x); itemTag.setInteger("yCoord", y); itemTag.setInteger("zCoord", z); itemTag.setInteger("dimensionId", world.provider.dimensionId); return true; } } player.openGui(AlchemicalWizardry.instance, 1, world, x, y, z); return true; }
@Override public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (player.isSneaking()) { return false; } TileEntity te = world.getBlockTileEntity(x, y, z); if (te instanceof TileEntityReactorRedstonePort) { if (!((TileEntityReactorRedstonePort) te).isConnected()) { return false; } if (!world.isRemote) ((TileEntityReactorRedstonePort) te).sendRedstoneUpdate(); if (!world.isRemote) { player.openGui(BRLoader.instance, 0, world, x, y, z); } return true; } return false; }
public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { DMPedestalTile tile = ((DMPedestalTile) world.getTileEntity(x, y, z)); if (player.isSneaking()) { player.openGui(PECore.instance, Constants.PEDESTAL_GUI, world, x, y, z); } else { if (tile.getItemStack() != null && tile.getItemStack().getItem() instanceof IPedestalItem) { tile.setActive(!tile.getActive()); } PELogger.logDebug("Pedestal: " + (tile.getActive() ? "ON" : "OFF")); } PacketHandler.sendToAllAround( new ClientSyncPedestalPKT(tile), new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32)); } return true; }
public void openGui(EntityPlayer player, int id, World world, int x, int y, int z) { if (debugGui) System.out.printf( "BaseMod.openGui: for %s with id %s in %s at (%s, %s, %s)\n", /*base*/ this, id, world, x, y, z); player.openGui(/*base*/ this, id, world, x, y, z); }