java类cpw.mods.fml.common.eventhandler.SubscribeEvent的实例源码

MEventHandler.java 文件源码 项目:PAYDAY 阅读 28 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onTickEvent(TickEvent.PlayerTickEvent evt) {
    if (tick >= 15) {
        for (TileEntity t : (List<TileEntity>) evt.player.worldObj.loadedTileEntityList) {
            if (t instanceof LobbyTileEntity) {
                tile = (LobbyTileEntity) t;

                if (tile.players.size() != tile.blockMetadata)
                    tile.check();
            }
        }

        tick = 0;
    }
}
CreeperHostServer.java 文件源码 项目:CreeperHostGui 阅读 24 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void clientConnectedtoServer(FMLNetworkEvent.ServerConnectionFromClientEvent event)
{
    if (!CreeperHost.instance.active)
        return;
    MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
    if (server == null || server.isSinglePlayer() || discoverMode != Discoverability.PUBLIC)
        return;

    INetHandlerPlayServer handler = event.handler;
    if (handler instanceof NetHandlerPlayServer)
    {
        EntityPlayerMP entity = ((NetHandlerPlayServer) handler).playerEntity;
        playersJoined.add(entity.getUniqueID());
    }
}
EventHandler.java 文件源码 项目:CreeperHostGui 阅读 25 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onActionPerformed(ActionPerformedEvent.Pre event)
{
    GuiScreen gui = Util.getGuiFromEvent(event);
    GuiButton button = Util.getButton(event);
    if (gui instanceof GuiMainMenu)
    {
        if (button != null && button.id == MAIN_BUTTON_ID)
        {
            Minecraft.getMinecraft().displayGuiScreen(GuiGetServer.getByStep(0, new Order()));
        }
    }
    else if (gui instanceof GuiMultiplayer)
    {
        if (button != null && button.id == MP_BUTTON_ID)
        {
            Minecraft.getMinecraft().displayGuiScreen(new GuiMultiplayerPublic(gui));
        }
    }
    else if (gui instanceof GuiIngameMenu && button.id == FRIEND_BUTTON_ID)
    {
        CreeperHost.proxy.openFriendsGui();
    }
}
EventHandler.java 文件源码 项目:CreeperHostGui 阅读 25 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event)
{
    if (!Config.getInstance().isSivIntegration())
        return;
    if (event.type != RenderGameOverlayEvent.ElementType.PLAYER_LIST)
    {
        return;
    }
    if (!(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) || Minecraft.getMinecraft().isIntegratedServerRunning() || !guiServerInfo.getIsPlayerOpped())
    {
        return;
    }

    Minecraft mc = Minecraft.getMinecraft();

    ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    guiServerInfo.setWorldAndResolution(mc, resolution.getScaledWidth(), resolution.getScaledHeight());
    if (guiServerInfo.renderServerInfo())
    {
        event.setCanceled(true);
    }
}
DamageRecalc.java 文件源码 项目:ExtraAcC 阅读 15 收藏 0 点赞 0 评论 0
@SubscribeEvent
  public void recalc(LivingHurtEvent event) {
if (!(event.entity instanceof EntityPlayer)) {
    return;
}
EntityPlayer player = (EntityPlayer) event.entity;
if (!AbilityData.get(player).isSkillLearned(SkillAirControl.INSTANCE)) {
    return;
}
if (event.source.getDamageType().equals("inWall") || event.source.getDamageType().equals("drown")) {
    event.ammount *= 0.1;
} else if (event.source.getDamageType().equals("fall")) {
    event.ammount *= 0.25;
} else if (event.source.isProjectile() || event.source.getDamageType().equals("anvil")) {
    event.ammount *= 0.75;
}
  }
ServerEventHandler.java 文件源码 项目:connor41-etfuturum2 阅读 42 收藏 0 点赞 0 评论 0
@SubscribeEvent
@SuppressWarnings("unchecked")
public void onWorldTick(TickEvent.ServerTickEvent event) {
    if (event.phase != TickEvent.Phase.END || event.side != Side.SERVER)
        return;

    if (EtFuturum.enablePlayerSkinOverlay)
        if (playerLoggedInCooldown != null)
            if (--playerLoggedInCooldown <= 0) {
                for (World world : MinecraftServer.getServer().worldServers)
                    for (EntityPlayer player : (List<EntityPlayer>) world.playerEntities) {
                        NBTTagCompound nbt = player.getEntityData();
                        if (nbt.hasKey(SetPlayerModelCommand.MODEL_KEY, Constants.NBT.TAG_BYTE)) {
                            boolean isAlex = nbt.getBoolean(SetPlayerModelCommand.MODEL_KEY);
                            EtFuturum.networkWrapper.sendToAll(new SetPlayerModelMessage(player, isAlex));
                        }
                    }
                playerLoggedInCooldown = null;
            }
}
ServerEventHandler.java 文件源码 项目:connor41-etfuturum2 阅读 25 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void arrowNock(ArrowNockEvent event) {
    if (event.result == null)
        return;
    IInventory invt = event.entityPlayer.inventory;
    for (int i = 0; i < invt.getSizeInventory(); i++) {
        ItemStack stack = invt.getStackInSlot(i);
        if (stack == null || stack.stackSize <= 0)
            continue;
        if (stack.getItem() == Items.arrow)
            return;
        if (stack.getItem() == ModItems.tipped_arrow) {
            event.setCanceled(true);
            event.entityPlayer.setItemInUse(event.result, event.result.getItem().getMaxItemUseDuration(event.result));
            return;
        }
    }
}
ServerEventHandler.java 文件源码 项目:connor41-etfuturum2 阅读 20 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onPlayerLoadFromFileEvent(PlayerEvent.LoadFromFile event) {
    if (!EtFuturum.enableEnchants)
        return;
    try {
        File file = event.getPlayerFile(Reference.MOD_ID);
        if (!file.exists()) {
            file.createNewFile();
            return;
        }

        BufferedReader br = new BufferedReader(new FileReader(file));
        String line = br.readLine();
        if (line != null) {
            int seed = Integer.parseInt(line);
            ContainerEnchantment.seeds.put(event.playerUUID, seed);
            br.close();
        }
    } catch (Exception e) {
    }
}
ServerEventHandler.java 文件源码 项目:connor41-etfuturum2 阅读 20 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onPlayerSaveFromFileEvent(PlayerEvent.SaveToFile event) {
    if (!EtFuturum.enableEnchants)
        return;
    try {
        File file = event.getPlayerFile(Reference.MOD_ID);
        if (!file.exists()) {
            file.createNewFile();
            return;
        }

        Integer seed = ContainerEnchantment.seeds.get(event.playerUUID);
        if (seed != null) {
            BufferedWriter bw = new BufferedWriter(new FileWriter(file));
            bw.write(seed.toString());
            bw.close();
        }
    } catch (IOException e) {
    }
}
ServerEventHandler.java 文件源码 项目:connor41-etfuturum2 阅读 29 收藏 0 点赞 0 评论 0
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void dropEvent(LivingDropsEvent event) {
    if (event.entityLiving.worldObj.isRemote)
        return;

    if (EtFuturum.enableSkullDrop)
        dropHead(event.entityLiving, event.source, event.lootingLevel, event.drops);

    Random rand = event.entityLiving.worldObj.rand;
    if (EtFuturum.enableMutton && event.entityLiving instanceof EntitySheep) {
        int amount = rand.nextInt(3) + 1 + rand.nextInt(1 + event.lootingLevel);
        for (int i = 0; i < amount; i++)
            if (event.entityLiving.isBurning())
                addDrop(new ItemStack(ModItems.cooked_mutton), event.entityLiving, event.drops);
            else
                addDrop(new ItemStack(ModItems.raw_mutton), event.entityLiving, event.drops);
    }
}
ServerEventHandler.java 文件源码 项目:connor41-etfuturum2 阅读 22 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void spawnEvent(EntityJoinWorldEvent event) {
    if (event.entity instanceof EntityPig) {
        EntityPig pig = (EntityPig) event.entity;
        if (EtFuturum.enableBeetroot)
            pig.tasks.addTask(4, new EntityAITempt(pig, 1.2, ModItems.beetroot, false));
    } else if (event.entity instanceof EntityChicken) {
        EntityChicken chicken = (EntityChicken) event.entity;
        if (EtFuturum.enableBeetroot)
            chicken.tasks.addTask(3, new EntityAITempt(chicken, 1.0D, ModItems.beetroot_seeds, false));
    } else if (event.entity instanceof EntityWolf) {
        EntityWolf wolf = (EntityWolf) event.entity;
        if (EtFuturum.enableRabbit)
            wolf.targetTasks.addTask(4, new EntityAITargetNonTamed(wolf, EntityRabbit.class, 200, false));
    } else if (event.entity instanceof EntityVillager) {
        EntityVillager villager = (EntityVillager) event.entity;
        for (Object obj : villager.tasks.taskEntries) {
            EntityAITaskEntry entry = (EntityAITaskEntry) obj;
            if (entry.action instanceof EntityAIOpenDoor) {
                villager.tasks.removeTask(entry.action);
                villager.tasks.addTask(entry.priority, new EntityAIOpenCustomDoor(villager, true));
                break;
            }
        }
    }
}
ServerEventHandler.java 文件源码 项目:connor41-etfuturum2 阅读 17 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void interactEntityEvent(EntityInteractEvent event) {
    ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
    if (stack == null)
        return;
    if (!(event.target instanceof EntityAnimal))
        return;

    EntityAnimal animal = (EntityAnimal) event.target;
    if (!animal.isChild()) {
        if (animal instanceof EntityPig) {
            if (stack.getItem() == ModItems.beetroot && EtFuturum.enableBeetroot)
                setAnimalInLove(animal, event.entityPlayer, stack);
        } else if (animal instanceof EntityChicken)
            if (stack.getItem() == ModItems.beetroot_seeds && EtFuturum.enableBeetroot)
                setAnimalInLove(animal, event.entityPlayer, stack);
    } else if (EtFuturum.enableBabyGrowthBoost && isFoodItem(animal, stack))
        feedBaby(animal, event.entityPlayer, stack);
}
ServerEventHandler.java 文件源码 项目:connor41-etfuturum2 阅读 20 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void entityHurtEvent(LivingHurtEvent event) {
    if (!EtFuturum.enableDmgIndicator)
        return;
    int amount = MathHelper.floor_float(Math.min(event.entityLiving.getHealth(), event.ammount) / 2F);
    if (amount <= 0)
        return;

    // If the attacker is a player spawn the hearts aligned and facing it
    if (event.source instanceof EntityDamageSource) {
        EntityDamageSource src = (EntityDamageSource) event.source;
        Entity attacker = src.getSourceOfDamage();
        if (attacker instanceof EntityPlayer && !(attacker instanceof FakePlayer)) {
            EntityPlayer player = (EntityPlayer) attacker;
            Vec3 look = player.getLookVec();
            look.rotateAroundY((float) Math.PI / 2);
            for (int i = 0; i < amount; i++) {
                double x = event.entityLiving.posX - amount * 0.35 * look.xCoord / 2 + i * 0.35 * look.xCoord;
                double y = event.entityLiving.posY + 1.5 + event.entityLiving.worldObj.rand.nextGaussian() * 0.05;
                double z = event.entityLiving.posZ - amount * 0.35 * look.zCoord / 2 + i * 0.35 * look.zCoord;
                EtFuturum.networkWrapper.sendToAllAround(new BlackHeartParticlesMessage(x, y, z), new TargetPoint(player.worldObj.provider.dimensionId, x, y, z, 64));
            }
        }
    }
}
CoreHandler.java 文件源码 项目:McHeliPrivacyShield 阅读 27 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onScreenShotShield(final @Nonnull ScreenShotShieldEvent.Post event) {
    if (Config.getConfig().notifyChat.get()) {
        final String mode = ScreenShotShieldRegistery.getListener(Config.getConfig().ssmode.get()).name();
        ChatBuilder.create("mchelishield.notification.chat.screenshot.message").useTranslation().setParams(mode).chatClient();
        ChatBuilder.create("mchelishield.notification.chat.screenshot.message.mode").useTranslation().setParams(mode).chatClient();
    }
    if (Config.getConfig().notifySound.get())
        FMLClientHandler.instance().getClient().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("mchelishield", "notification.sound"), 1.0F));
    if (Config.getConfig().notifyEffect.get())
        this.effectStrength = .75f;
    if (Config.getConfig().notifyOverlay.get()) {
        this.text = I18n.format("mchelishield.notification.overlay.screenshot.message");
        this.textStrength = 1f;
    }
}
CoreHandler.java 文件源码 项目:McHeliPrivacyShield 阅读 29 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onModListShield(final @Nonnull ModListShieldEvent.Post event) {
    if (Config.getConfig().notifyChat.get()) {
        final String mode = ModListShieldRegistery.getListener(Config.getConfig().mlmode.get()).name();
        ChatBuilder.create("mchelishield.notification.chat.modlist.message").useTranslation().setParams(mode).chatClient();
        ChatBuilder.create("mchelishield.notification.chat.modlist.message.mode").useTranslation().setParams(mode).chatClient();
    }
    if (Config.getConfig().notifySound.get())
        FMLClientHandler.instance().getClient().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("mchelishield", "notification.sound"), 1.0F));
    if (Config.getConfig().notifyEffect.get())
        this.effectStrength = .75f;
    if (Config.getConfig().notifyOverlay.get()) {
        this.text = I18n.format("mchelishield.notification.overlay.modlist.message");
        this.textStrength = 1f;
    }
}
JoinEvent.java 文件源码 项目:EasyLogin 阅读 21 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void keyListener(KeyInputEvent event) throws IOException {
    if (EasyLogin.logingui.isPressed()) {
        Minecraft mc = Minecraft.getMinecraft();
        mc.displayGuiScreen(new MainGui(mc.currentScreen));
        // 密码读取
        InputStream in = new BufferedInputStream(new FileInputStream("config/easylogin.properties"));
        prop.load(in);
        // 解密密码
        byte[] passwordByte = prop.getProperty("PassWord").getBytes();
        byte key = 124;
        for (int i = 0; i < passwordByte.length; i++) {
            passwordByte[i] ^= key;
        }
        MainGui.settext(new String(passwordByte));
        System.out.println(new String(passwordByte));
    }
}
ClientEventHandler.java 文件源码 项目:HazardsLib 阅读 23 收藏 0 点赞 0 评论 0
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderTick(TickEvent.RenderTickEvent event)
{
    Minecraft mc = FMLClientHandler.instance().getClient();
    World world = mc.theWorld;

    if (event.phase != TickEvent.Phase.START) {
        if ((Minecraft.getMinecraft().renderViewEntity instanceof EntityPlayer)) {
            EntityPlayer player = (EntityPlayer)Minecraft.getMinecraft().renderViewEntity;

            if ((player != null) && (mc.inGameHasFocus) && (Minecraft.isGuiEnabled())) {
                // If player have radiation detector on hotbar.
                if (isPlayerHasItemOnHotbar(player.inventory, ItemsHZDS.radiation_detector)) {
                    PlayerTracker tracker = TrackerManager.lookupTrackerFromUsername(mc.thePlayer.getCommandSenderName());

                    if (tracker != null) {
                        renderRadiation(tracker);
                    }
                }

            }
        }
    }
}
CommonEventHandler.java 文件源码 项目:HazardsLib 阅读 19 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onPlayerClone(PlayerEvent.Clone event)
{
    PlayerTracker tracker = TrackerManager.lookupTracker(event.original);

    if (tracker != null) {
        HazardsLib.modLog.info("Changing tracker owner for: '" + event.entity.getCommandSenderName() + "'...");
        tracker.owner = event.entityPlayer;

        if (event.wasDeath) {
            tracker.resetData();
            TrackerManager.saveTracker(tracker);
        }

        tracker.loadFromNBT();
    }

    if (event.wasDeath) {
        doDeath(event.entityPlayer);
        doDeath(event.original);
    }
}
Listener.java 文件源码 项目:minecraft-quiverbow 阅读 31 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void ItemCraftedEvent(cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent event)
{
    //System.out.println("[EVENT] Player crafted something.");

    if (event.crafting != null && event.crafting.getItem() instanceof ERA)
    {
        ItemStack stack = event.craftMatrix.getStackInSlot(1);

        if (stack != null && stack.stackSize > 1)
        {
            stack.stackSize -= 26;
            if (stack.stackSize <= 0) { event.craftMatrix.setInventorySlotContents(1, null); }  // Nothing left
        }
        // else, nothing in there or only a single rail, meaning this is a repairing event. I'm fine with that
    }
    // else, not mine, so don't care

    else if (event.crafting != null && event.crafting.getItem() instanceof _WeaponBase) // More generic weapon check
    {
        this.copyName(event.craftMatrix, event.crafting);
    }
}
CraftingHandler.java 文件源码 项目:TFCPrimitiveTech 阅读 20 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onCrafting(ItemCraftedEvent e)
{
    ItemStack itemstack = e.crafting;
    Item item = itemstack.getItem();
    IInventory inventory = e.craftMatrix;

    if (item == null || inventory == null) return;
        if(inventory != null)
        {
            if(item == ModItems.itemWoodenTwig)
                com.bioxx.tfc.Handlers.CraftingHandler.handleItem(e.player, e.craftMatrix, Recipes.hammers);
            if(item == TFCItems.stick)
                com.bioxx.tfc.Handlers.CraftingHandler.handleItem(e.player, e.craftMatrix, Recipes.knives);
        }


}
ModEventHandler.java 文件源码 项目:Ye-Olde-Chat 阅读 23 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onEntityJoinWorld(EntityJoinWorldEvent event)
{
    if (!event.entity.worldObj.isRemote && event.entity instanceof EntityPlayer)
    {
        EntityPlayer player = (EntityPlayer) event.entity;

        PlayerRoleplayMode props = PlayerRoleplayMode.get(player);
        NBTTagCompound playerDataRoleplayMode = CommonProxy.getEntityData((player).getCommandSenderName());
        if (playerDataRoleplayMode != null)
        {
            props.loadNBTData(playerDataRoleplayMode);
        }

        PacketHandler.INSTANCE.sendTo(new MessageSyncRoleplayMode(player), (EntityPlayerMP) player);
    }
}
TOEvents.java 文件源码 项目:ThaumOres 阅读 15 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void eventBreakEvent(BlockEvent.BreakEvent event) {
    World world = event.world;
    int x = event.x;
    int y = event.y;
    int z = event.z;
    EntityPlayer player = event.getPlayer();

    if (player != null && player.getHeldItem() != null && player.getHeldItem().getItem() == Items.stick) {
        if (TOConfig.debugEnable && TOConfig.debugRemover && !world.isRemote
                && player.capabilities.isCreativeMode) {
            int radius = TOConfig.debugRemoverScannerRadius;
            for (int xx = x - radius; xx < x + radius; xx++)
                for (int zz = z - radius; zz < z + radius; zz++)
                    for (int yy = 0; yy < 257; yy++)
                        if (!(world.getBlock(xx, yy, zz) instanceof BlockInfusedBlockOre))
                            world.setBlock(xx, yy, zz, Blocks.air, 0, 2);
            String text = "[DEBUG " + ThaumOresMod.NAME + "] Removed blocks at " + x + ";" + z + " with radius "
                    + radius;
            player.addChatMessage(new ChatComponentText(text));
            ThaumOresMod.log.info(text);
        }
    }
}
ForgeModContainer.java 文件源码 项目:TRHS_Club_Mod_2016 阅读 23 收藏 0 点赞 0 评论 0
/**
 * By subscribing to the OnConfigChangedEvent we are able to execute code when our config screens are closed.
 * This implementation uses the optional configID string to handle multiple Configurations using one event handler.
 */
@SubscribeEvent
public void onConfigChanged(OnConfigChangedEvent event)
{
    if (getMetadata().modId.equals(event.modID) && !event.isWorldRunning)
    {
        if (Configuration.CATEGORY_GENERAL.equals(event.configID))
        {
            syncConfig(false);
        }
        else if ("chunkLoader".equals(event.configID))
        {
            ForgeChunkManager.syncConfigDefaults();
            ForgeChunkManager.loadConfiguration();
        }
    }
}
EventHandlerServer.java 文件源码 项目:ExtraUtilities 阅读 31 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void updateEntity(final LivingEvent.LivingUpdateEvent event) {
    if (event.entity.worldObj.isRemote) {
        return;
    }
    if (event.entity.getEntityData().hasKey("CursedEarth")) {
        int c = event.entity.getEntityData().getInteger("CursedEarth");
        if (c == 0) {
            event.entity.setDead();
            NetworkHandler.sendParticle(event.entity.worldObj, "smoke", event.entity.posX, event.entity.posY + event.entity.height / 4.0f, event.entity.posZ, 0.0, 0.0, 0.0, false);
        }
        else {
            --c;
            event.entity.getEntityData().setInteger("CursedEarth", c);
        }
    }
}
PlaceStorageEvent.java 文件源码 项目:FissionWarfare 阅读 17 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onBlockPlace(PlaceEvent event) {

    Location loc = new Location(event.world, event.x, event.y, event.z);
    TileEntity tileEntity = loc.getTileEntity();

    if (tileEntity instanceof TileEntityEnergyBase) {

        TileEntityEnergyBase energy = (TileEntityEnergyBase) tileEntity;

        NBTTagCompound nbt = NBTUtil.getNBT(event.itemInHand);

        if (nbt.hasKey("energy")) {
            energy.storage.modifyEnergyStored(nbt.getInteger("energy"));
        }
    }   
}
SimpleComponentTickHandler.java 文件源码 项目:OpenTechnology 阅读 20 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void onTick(TickEvent.ServerTickEvent e) {
    if (e.phase == TickEvent.Phase.START) {
        final Runnable[] adds;
        synchronized (pending) {
            adds = pending.toArray(new Runnable[pending.size()]);
            pending.clear();
        }
        for (Runnable runnable : adds) {
            try {
                runnable.run();
            } catch (Throwable t) {
                log.warn("Error in scheduled tick action.", t);
            }
        }
    }
}
EventHandlerGC.java 文件源码 项目:4Space-5 阅读 28 收藏 0 点赞 0 评论 0
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void schematicFlipEvent(FlipPage event)
{
    ISchematicPage page = null;

    switch (event.direction)
    {
    case 1:
        page = EventHandlerGC.getNextSchematic(event.index);
        break;
    case -1:
        page = EventHandlerGC.getLastSchematic(event.index);
        break;
    }

    if (page != null)
    {
        GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_OPEN_SCHEMATIC_PAGE, new Object[] { page.getPageID() }));
        FMLClientHandler.instance().getClient().thePlayer.openGui(GalacticraftCore.instance, page.getGuiID(), FMLClientHandler.instance().getClient().thePlayer.worldObj, (int) FMLClientHandler.instance().getClient().thePlayer.posX, (int) FMLClientHandler.instance().getClient().thePlayer.posY, (int) FMLClientHandler.instance().getClient().thePlayer.posZ);
    }
}
TConEvents.java 文件源码 项目:ExtraUtilities 阅读 29 收藏 0 点赞 0 评论 0
@SubscribeEvent
public void addUnstableTimer(final SmelteryCastedEvent.CastingTable event) {
    if (ExtraUtils.tcon_unstable_material_id <= 0) {
        return;
    }
    final ItemStack output = event.output;
    if (output == null || !(output.getItem() instanceof IToolPart)) {
        return;
    }
    final IToolPart part = (IToolPart)output.getItem();
    if (part.getMaterialID(output) != ExtraUtils.tcon_unstable_material_id) {
        return;
    }
    final NBTTagCompound tag = getOrInitTag(output);
    final WorldServer world = DimensionManager.getWorld(0);
    if (world == null) {
        return;
    }
    tag.setLong("XUDeadline", world.getTotalWorldTime());
    final WorldServer localWorld = DimensionManager.getWorld(this.curDim);
    if (localWorld != null) {
        tag.setLong("XULocalDeadline", localWorld.getTotalWorldTime());
        tag.setInteger("XULocalDim", this.curDim);
    }
}
TConEvents.java 文件源码 项目:ExtraUtilities 阅读 27 收藏 0 点赞 0 评论 0
@SubscribeEvent(priority = EventPriority.LOWEST)
public void denyCraft(final ToolBuildEvent event) {
    if (ExtraUtils.tcon_unstable_material_id <= 0) {
        return;
    }
    final WorldServer world = DimensionManager.getWorld(0);
    if (world == null) {
        return;
    }
    if (isToolExpired(event.headStack, world) || isToolExpired(event.handleStack, world) || isToolExpired(event.accessoryStack, world) || isToolExpired(event.extraStack, world)) {
        event.headStack = null;
        event.handleStack = null;
        event.accessoryStack = null;
        event.extraStack = null;
    }
}
EnderPearlListener.java 文件源码 项目:WorldBorder-Forge 阅读 32 收藏 0 点赞 0 评论 0
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onPlayerPearl(EnderTeleportEvent event)
{
    if ( !(event.entityLiving instanceof EntityPlayerMP) )
        return;

    if ( Config.getKnockBack() == 0.0 || !Config.getDenyEnderpearl() )
        return;

    EntityPlayerMP player = (EntityPlayerMP) event.entityLiving;
    Log.trace( "Caught pearl teleport event by %s", player.getDisplayName() );

    Location target = new Location(event, player);
    Location newLoc = BorderCheck.checkPlayer(player, target, true, true);

    if (newLoc != null)
    {
        event.setCanceled(true);
        event.targetX = newLoc.posX;
        event.targetY = newLoc.posY;
        event.targetZ = newLoc.posZ;
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号