Java 类cpw.mods.fml.common.eventhandler.EventPriority 实例源码

项目:connor41-etfuturum2    文件:ServerEventHandler.java   
@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);
    }
}
项目:ExtraUtilities    文件:EventHandlerServer.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void updateSoulDrain(final LivingSpawnEvent event) {
    if (event.world.isRemote) {
        return;
    }
    if (!EntityPlayerMP.class.equals(event.getClass())) {
        return;
    }
    final IAttributeInstance a = event.entityLiving.getAttributeMap().getAttributeInstanceByName(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName());
    final AttributeModifier attr = a.getModifier(ItemSoul.uuid);
    if (attr == null || attr.getOperation() == 2) {
        return;
    }
    final double l = attr.getAmount() / 20.0;
    a.removeModifier(attr);
    a.applyModifier(new AttributeModifier(ItemSoul.uuid, "Missing Soul", l, 0));
}
项目:ExtraUtilities    文件:EventHandlerClient.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void entityColorRender(final RenderLivingEvent.Pre event) {
    final String s = EnumChatFormatting.getTextWithoutFormattingCodes(event.entity.getCommandSenderName());
    if (s.startsWith("Aureylian") && !(event.entity instanceof EntityPlayer)) {
        GL11.glColor4f(0.9686f, 0.7059f, 0.8392f, 1.0f);
        this.resetRender = true;
    }
    if (EventHandlerClient.holograms.contains(s) && (!(event.entity instanceof EntityPlayer) || !((EntityPlayer)event.entity).getHideCape())) {
        GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.45f);
        GL11.glEnable(3042);
        GL11.glBlendFunc(770, 771);
        this.resetRender = true;
    }
    if (s.equals("RWTema") && !(event.entity instanceof EntityPlayer)) {
        GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.65f);
        GL11.glEnable(3042);
        GL11.glBlendFunc(770, 771);
        this.resetRender = true;
    }
    if (s.equals("jadedcat") && (!(event.entity instanceof EntityPlayer) || !((EntityPlayer)event.entity).getHideCape())) {
        GL11.glColor4f(0.69f, 0.392f, 0.847f, 1.0f);
        this.resetRender = true;
    }
}
项目:ExtraUtilities    文件:TConEvents.java   
@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;
    }
}
项目:FissionWarfare    文件:GunRenderEvent.java   
@SubscribeEvent(priority=EventPriority.LOW)
public void gunRenderEvent(RenderPlayerEvent.Pre event) {

    ItemStack item = event.entityPlayer.getHeldItem();

    RenderPlayer rp = event.renderer;

    if (item != null && item.getItem() instanceof ItemGun) {

        rp.modelBipedMain.aimedBow = true;
        rp.modelArmor.aimedBow = true;
        rp.modelArmorChestplate.aimedBow = true;
    } 

    else {
        rp.modelBipedMain.aimedBow = false;
        rp.modelArmor.aimedBow = false;
        rp.modelArmorChestplate.aimedBow = false;
    }
}
项目:BetterChat    文件:EventHandler.java   
@SubscribeEvent(priority=EventPriority.LOWEST)
public void onServerChat(ServerChatEvent e)
{
    EntityPlayerMP sender = e.player;
    List<EntityPlayerMP> players = MinecraftServer.getServer().getConfigurationManager().playerEntityList;


    String finalMessage = ChatFormatter.ChatParser(sender);


    for (EntityPlayerMP receiver : players)
    {receiver.addChatMessage(new ChatComponentText(finalMessage + "<" + e.username + ">: " + e.message));
    }

    BetterChat.bLog.info(sender.getDisplayName() + " said: " + e.message);
    e.setCanceled(true);
}
项目:PopularMMOS-EpicProportions-Mod    文件:ClientProxy.java   
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(PlayerTickEvent event)
{

    if (!ClientProxy.haveWarnedVersionOutOfDate && event.player.worldObj.isRemote 
          && !ClientProxy.versionChecker.isLatestVersion())
    {
        ClickEvent versionCheckChatClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, 
              "http://www.planetminecraft.com/mod/popularmmos-epicproportions-mod-season-9/");
        ChatStyle clickableChatStyle = new ChatStyle().setChatClickEvent(versionCheckChatClickEvent);
        ChatComponentText versionWarningChatComponent = 
              new ChatComponentText("Your EpicProportions Mod is not latest version!  Click here to update.");
        versionWarningChatComponent.setChatStyle(clickableChatStyle);
        event.player.addChatMessage(versionWarningChatComponent);
        ClientProxy.haveWarnedVersionOutOfDate = true;
    }

}
项目:PopularMMOS-EpicProportions-Mod    文件:VersionChecker.java   
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(PlayerTickEvent event)
{

    if (!ClientProxy.haveWarnedVersionOutOfDate && event.player.worldObj.isRemote 
          && !ClientProxy.versionChecker.isLatestVersion())
    {
        ClickEvent versionCheckChatClickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL, 
              "http://www.planetminecraft.com/mod/popularmmos-epicproportions-mod-season-9/");
        ChatStyle clickableChatStyle = new ChatStyle().setChatClickEvent(versionCheckChatClickEvent);
        ChatComponentText versionWarningChatComponent = 
              new ChatComponentText("�4�l" + "Your EpicProportions Mod is not latest version!  Click here to update.");
        versionWarningChatComponent.setChatStyle(clickableChatStyle);
        event.player.addChatMessage(versionWarningChatComponent);
        ClientProxy.haveWarnedVersionOutOfDate = true;
    }

}
项目:WorldBorder-Forge    文件:EnderPearlListener.java   
@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;
    }
}
项目:PrimitiveCraft    文件:WorldGenStones.java   
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onWorldDecoration(DecorateBiomeEvent.Decorate event) 
{
    if ((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.type == EventType.FLOWERS) 
    {
        for(int i = 0; i < 2; i++) 
        {
            int x = event.chunkX + event.rand.nextInt(16) + 8;
            int z = event.chunkZ + event.rand.nextInt(16) + 8;
            int y = event.world.getTopSolidOrLiquidBlock(x, z);

            if(event.world.isAirBlock(x, y, z) && Blocks.flower_pot.canBlockStay(event.world, x, y, z) && ConfigPrimitiveCraft.genrocks)
            {
                event.world.setBlock(x, y, z, ModBlocks.rock);
            }
            else if(event.world.getBlock(x, y, z) == Blocks.water && ConfigPrimitiveCraft.genshale)
            {
                event.world.setBlock(x, y-1, z, ModBlocks.shale);
            }
        }
    }
}
项目:OpenFM    文件:OpenFM.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(GuiOpenEvent event) {
    if (event.gui instanceof GuiIngameModOptions) {
        event.gui = new GuiModList(new GuiIngameMenu());
    }
}
项目:ThermalRecycling    文件:BreedingItemManager.java   
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = false)
public void entityInteract(final EntityInteractEvent event) {
    if(event.entityPlayer instanceof EntityPlayerMP && event.target instanceof EntityAnimal) {
        final EntityPlayerMP player = (EntityPlayerMP)event.entityPlayer;
        final ItemStack heldItem = player.getCurrentEquippedItem();
        if(heldItem != null) {
            final EntityAnimal animal = (EntityAnimal)event.target;
            if(canBreed(animal, player)) {
                final Set<ItemStackKey> possibleFood = foodItems.get(event.target.getClass());
                if(possibleFood != null && possibleFood.contains(ItemStackKey.getCachedKey(heldItem))) {
                    if (!event.entityPlayer.capabilities.isCreativeMode) {
                        heldItem.stackSize--;
                        if (heldItem.stackSize <= 0)
                            player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
                    }
                    animal.func_146082_f(player);
                }
            }
        }
    }
}
项目:TickDynamic    文件:TickDynamicMod.java   
@SubscribeEvent(priority=EventPriority.LOWEST)
public void tickEventEnd(ServerTickEvent event) {   
    if(event.phase == Phase.END)
    {
    getTimedGroup("other").endTimer();
    root.endTick(true);

    if(debugTimer)
        System.out.println("Tick time used: " + (root.getTimeUsed()/root.timeMilisecond) + "ms");

    //After every world is done ticking, re-balance the time slices according
    //to the data gathered during the tick.
    root.balanceTime();

    //Calculate TPS
    updateTPS();

    if(saveConfig)
    {
        saveConfig = false;
        config.save();
    }
    }
}
项目:FusionWarfare    文件:GunRenderEvent.java   
@SubscribeEvent(priority=EventPriority.LOW)
public void gunRenderEvent(RenderPlayerEvent.Pre event) {

    ItemStack item = event.entityPlayer.getHeldItem();

    RenderPlayer rp = event.renderer;

    if (item != null && (item.getItem() instanceof ItemFusionGun || item.getItem() instanceof ItemRocketLauncher)) {

        rp.modelBipedMain.aimedBow = true;
        rp.modelArmor.aimedBow = true;
        rp.modelArmorChestplate.aimedBow = true;
    } else {
        rp.modelBipedMain.aimedBow = false;
        rp.modelArmor.aimedBow = false;
        rp.modelArmorChestplate.aimedBow = false;
    }
}
项目:Biota    文件:TerrainEventHandler.java   
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onBiomeDecoration(DecorateBiomeEvent.Decorate event)
{
    if (event.type == DecorateBiomeEvent.Decorate.EventType.FLOWERS && (event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT))
    {
        for (int i = 0; i < Settings.FLOWER_QUANTITY; i++)
        {
            int x = event.chunkX + event.rand.nextInt(16) + 8;
            int z = event.chunkZ + event.rand.nextInt(16) + 8;
            int y = event.world.getTopSolidOrLiquidBlock(x, z);
            Block randomPlant = ModBlocks.plants[event.rand.nextInt(ModBlocks.plants.length)];

            if (event.world.isAirBlock(x, y, z) && (!event.world.provider.hasNoSky || y < 255) && randomPlant.canBlockStay(event.world, x, y, z))
            {
                event.world.setBlock(x, y, z, randomPlant, 0, 2);
            }
        }
    }
}
项目:HarderStart    文件:HS_PlayerAttackEntity.java   
/**
 * Makes stick truly a rudimentary weapon TODO add damage to stick info
 * 
 * @param event
 */
@SubscribeEvent(priority = EventPriority.NORMAL)
public void playerAttackEvent(AttackEntityEvent event)
{
    EntityPlayer player = event.entityPlayer;
    ItemStack itemstack = player.getCurrentEquippedItem();

    if (player != null)
    {
        if (!player.capabilities.disableDamage && itemstack != null)
        {
            if (OreDictionary.itemMatches(new ItemStack(Items.stick), itemstack, true))
            {
                event.target.attackEntityFrom(DamageSource.causePlayerDamage(player), 2.0F);
            }
        }
    }

    return;
}
项目:Et-Futurum    文件:ServerEventHandler.java   
@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);
    }
}
项目:TheDarkEra    文件:GuiManaBar.java   
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderExperienceBar(RenderGameOverlayEvent event) {

    if (event.isCancelable() || event.type != ElementType.EXPERIENCE) {
        return;
    }
    if (!mc.thePlayer.capabilities.isCreativeMode) {
        int posX = event.resolution.getScaledWidth() / 2 + 10;
        int posY = event.resolution.getScaledHeight() - 48;
        ExtendedPlayer props = ExtendedPlayer.get((EntityPlayer) Minecraft.getMinecraft().thePlayer);
        float maxMana = props.getMaxMana();
        int manabarwidth = (int) ((float) props.getMana() / maxMana * 48);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_LIGHTING);
        this.mc.getTextureManager().bindTexture(texturepath);
        mc.renderEngine.bindTexture(new ResourceLocation(TheDarkEra.MODID + ":textures/gui/SoulBar.png"));
        mc.ingameGUI.drawTexturedModalRect(posX, posY, 0, 0, 50, 5);
        mc.ingameGUI.drawTexturedModalRect(posX + 1, posY + 1, 0, 6, manabarwidth, 3);
        String a = ""+props.getMaxMana();
        String b = ""+props.getMana();
        mc.fontRenderer.drawStringWithShadow(a, posX, posY, 0xFFFFFF);
        mc.fontRenderer.drawStringWithShadow(b, posX, posY+8, 0xFFFFFF);
        System.out.println(maxMana);
    }
}
项目:Gadomancy    文件:EventHandlerGolem.java   
@SubscribeEvent(priority = EventPriority.NORMAL)
public void on(LivingHurtEvent event) {
    if (!event.entity.worldObj.isRemote) {
        if(event.entity instanceof EntityGolemBase) {
            EntityGolemBase golem = (EntityGolemBase) event.entity;
            if(event.ammount > 0 && RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(golem)) {
                event.ammount = RegisteredGolemStuff.upgradeRunicShield.absorb(golem, event.ammount, event.source);
            }
        }

        /*if(event.source.getEntity() != null && event.source.getEntity() instanceof EntityGolemBase
                && ((EntityGolemBase) event.source.getEntity()).getGolemType()
                    == RegisteredGolemStuff.typeObsidian.getEnumEntry()) {
            event.entityLiving.addPotionEffect(new PotionEffect(Potion.wither.getId(), 3*20, 1));
        }*/
    }
}
项目:Gadomancy    文件:EventHandlerGolem.java   
@SubscribeEvent(priority = EventPriority.LOWEST)
public void on(ItemTooltipEvent event) {
    if(event.itemStack != null) {
        if(event.itemStack.getItem() instanceof ItemGolemPlacer
                || event.itemStack.getItem() instanceof ItemAdditionalGolemPlacer) {
            if(RegisteredGolemStuff.upgradeRunicShield.hasUpgrade(event.itemStack)) {
                event.toolTip.add("\u00a76" + StatCollector.translateToLocal("item.runic.charge") + " +" + RegisteredGolemStuff.upgradeRunicShield.getChargeLimit(event.itemStack));
            }

            AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(event.itemStack);
            if(core != null) {
                String searchStr = StatCollector.translateToLocal("item.ItemGolemCore.name");
                for(int i = 0; i < event.toolTip.size(); i++) {
                    String line = event.toolTip.get(i);
                    if(line.contains(searchStr)) {
                        int index = line.indexOf('\u00a7', searchStr.length()) + 2;
                        event.toolTip.remove(i);
                        event.toolTip.add(i, line.substring(0, index) + StatCollector.translateToLocal(core.getUnlocalizedName()));
                        break;
                    }
                }
            }
        }
    }
}
项目:Gadomancy    文件:EventHandlerWorld.java   
@SubscribeEvent(priority = EventPriority.LOW)
public void on(EntityJoinWorldEvent event) {
    if(!event.world.isRemote && event.entity instanceof EntityItem) {
        ItemStack stack = ((EntityItem) event.entity).getEntityItem();
        if(isDisguised(stack)) {
            long time = event.world.getTotalWorldTime() + event.world.rand.nextInt(60) + 40;
            trackedItems.put((EntityItem) event.entity, time);
        }
        if(stack.getItem() instanceof ItemElement && !(event.entity instanceof EntityItemElement)) {
            event.setCanceled(true);
            EntityItem newItem = new EntityItemElement(event.world,
                    event.entity.posX, event.entity.posY, event.entity.posZ,
                    ((EntityItem) event.entity).getEntityItem());
            newItem.delayBeforeCanPickup = ((EntityItem) event.entity).delayBeforeCanPickup;
            newItem.motionX = event.entity.motionX;
            newItem.motionY = event.entity.motionY;
            newItem.motionZ = event.entity.motionZ;
            event.world.spawnEntityInWorld(newItem);
        }
    }
}
项目:Gadomancy    文件:EventHandlerWorld.java   
@SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true)
public void on(BlockEvent.PlaceEvent e) {
    if (e.isCanceled()) {
        if (interacts != null)
            interacts.remove(e.player);
    } else {
        if (!e.world.isRemote && isStickyJar(e.itemInHand)) {
            TileEntity parent = e.world.getTileEntity(e.x, e.y, e.z);
            if (parent instanceof TileJarFillable) {
                int metadata = e.world.getBlockMetadata(e.x, e.y, e.z);
                e.world.setBlock(e.x, e.y, e.z, RegisteredBlocks.blockStickyJar, metadata, 2);

                TileEntity tile = e.world.getTileEntity(e.x, e.y, e.z);
                if (tile instanceof TileStickyJar) {
                    Integer sideHit = interacts.get(e.player);
                    ((TileStickyJar) tile).init((TileJarFillable) parent, e.placedBlock, metadata,
                            ForgeDirection.getOrientation(sideHit == null ? 1 : sideHit).getOpposite());
                    RegisteredBlocks.blockStickyJar.onBlockPlacedBy(e.world, e.x, e.y, e.z, e.player, e.itemInHand);
                }
            }
        }
    }
}
项目:Gadomancy    文件:EventHandlerWorld.java   
@SubscribeEvent(priority = EventPriority.LOWEST)
public void on(PlayerInteractEvent e) {
    if (!e.world.isRemote && e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK
            && isStickyJar(e.entityPlayer.getHeldItem())) {
        if (interacts == null) {
            interacts = new HashMap<EntityPlayer, Integer>();
        }
        interacts.put(e.entityPlayer, e.face);
    }

    if (e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
        ItemStack i = e.entityPlayer.getHeldItem();
        if (i != null && (i.getItem() instanceof ItemWandCasting)) {
            WandHandler.handleWandInteract(e.world, e.x, e.y, e.z, e.entityPlayer, i);
        }
    }
}
项目:Gadomancy    文件:EventHandlerWorld.java   
@SubscribeEvent(priority = EventPriority.NORMAL)
public void on(ItemTooltipEvent e) {
    if (e.toolTip.size() > 0 && e.itemStack.hasTagCompound()) {
        if (e.itemStack.stackTagCompound.getBoolean("isStickyJar")) {
            e.toolTip.add(1, "\u00a7a" + StatCollector.translateToLocal("gadomancy.lore.stickyjar"));
        }
    }

    if(e.toolTip.size() > 0 && NBTHelper.hasPersistentData(e.itemStack)) {
        NBTTagCompound compound = NBTHelper.getPersistentData(e.itemStack);
        if(compound.hasKey("disguise")) {
            NBTBase base = compound.getTag("disguise");
            String lore;
            if(base instanceof NBTTagCompound) {
                ItemStack stack = ItemStack.loadItemStackFromNBT((NBTTagCompound) base);
                lore = String.format(StatCollector.translateToLocal("gadomancy.lore.disguise.item"), EnumChatFormatting.getTextWithoutFormattingCodes(stack.getDisplayName()));
            } else {
                lore = StatCollector.translateToLocal("gadomancy.lore.disguise.none");
            }
            e.toolTip.add("\u00a7a" + lore);
        }
    }
}
项目:D3Log    文件:ForgeEventHandlers.java   
@SubscribeEvent(priority = EventPriority.LOWEST)
public void playerInteractEvent(PlayerInteractEvent event)
{
    WorldInteractLogEvent log = new WorldInteractLogEvent();

    log.setType(TYPE_INTERACT_WORLD);
    if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR)
    {
        log.setPlayerPosAndUuid(event.entityPlayer);
    }
    else
    {
        log.setPlayerUUID(event.entityPlayer);
        log.setPosition(event.entity.dimension, event.x, event.y, event.z);
        log.setData(event.action, event.face, event.entityPlayer.getCurrentEquippedItem());
    }

    LoggingQueue.addToQueue(log);
}
项目:D3Log    文件:ForgeEventHandlers.java   
@SubscribeEvent(priority = EventPriority.LOWEST)
public void blockBreakEvent(BlockEvent.BreakEvent event)
{
    BlockSnapshotLogEvent log = new BlockSnapshotLogEvent();

    log.setType(TYPE_BLOCK_BREAK);
    log.setPlayerUUID(event.getPlayer());
    log.setPosition(event.world.provider.dimensionId, event.x, event.y, event.z);
    NBTTagCompound nbt = null;
    if (event.block.hasTileEntity(event.blockMetadata))
    {
        TileEntity te = event.world.getTileEntity(event.x, event.y, event.z);
        if (te != null)
        {
            nbt = new NBTTagCompound();
            te.writeToNBT(nbt);
        }
    }
    log.setData(new BlockSnapshot(event.world, event.x, event.y, event.z, event.block, event.blockMetadata, nbt));

    LoggingQueue.addToQueue(log);
}
项目:SecureCraftProtect    文件:SCPGuiBlink.java   
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderExperienceBar(RenderGameOverlayEvent event)
{
    if (event.isCancelable() || event.type != EXPERIENCE) {
        return;
    }
    int width = event.resolution.getScaledWidth();
    int height = event.resolution.getScaledHeight();

    int k2 = height - 20;
    int blink = mc.thePlayer.getDataWatcher().getWatchableObjectInt(BLINK);
    int i4 = width / 2 + 91;
    int bar = MathHelper.ceiling_double_int((double) (blink + 2) * 10.0D
            / MAX_BLINK);
    glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    glDisable(GL_LIGHTING);
    mc.getTextureManager().bindTexture(icons);
    drawTexturedModalRect(i4 - 281, k2 - 1, 0, 18, 83, 11);
    drawTexturedModalRect(i4 - 301, k2 - 1, 83, 18, 17, 11);
    for (int i = 0; i < 10; ++i) {
        if (i < bar) {
            drawTexturedModalRect(i4 + i * 8 - 280, k2, 100, 18, 9, 9);
        }
    }
}
项目:Eureka    文件:EventHandler.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
//make sure it gets trigered first to prevent handeling from other mods
public void onPlayerUsesBlock(PlayerInteractEvent event) {
    String key = "";
    if (event.world.isRemote)
        return;
    EntityPlayer player = event.entityPlayer;
    PlayerResearch research = PlayerResearch.get(player);
    if (player.getCurrentEquippedItem() != null)
        key = EurekaAPI.API.getKey(player.getCurrentEquippedItem());
    if (!research.isFinished(key) && !key.equals("")) {
        ItemStack stack = player.getCurrentEquippedItem().copy();
        stack.stackSize = 1;
        dropItems(event.world, event.x, event.y, event.z, EurekaAPI.API.getDrops(stack));
        if (event.entityPlayer.getCurrentEquippedItem().stackSize > 1)
            event.entityPlayer.getCurrentEquippedItem().stackSize--;
        else
            event.entityPlayer.destroyCurrentEquippedItem();
        event.setCanceled(true);
    }

    key = EurekaAPI.API.getKey(event.world.getBlock(event.x, event.y, event.z));
    if (key != null && !key.equals("") && !research.isFinished(key))
        event.setCanceled(true);
}
项目:ItFellFromTheSky    文件:EventHandler.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onEntitySpawn(EntityJoinWorldEvent event)
{
    if(event.entity.worldObj.isRemote && event.entity instanceof EntityMeteorite && FMLCommonHandler.instance().getEffectiveSide().isClient() && !event.entity.isDead)
    {
        event.setCanceled(true);
        if(!event.entity.worldObj.weatherEffects.contains(event.entity))
        {
            boolean has = false;
            for(int i = 0; i < event.entity.worldObj.weatherEffects.size(); i++)
            {
                Entity ent = (Entity)event.entity.worldObj.weatherEffects.get(i);
                if(ent instanceof EntityMeteorite && ent.getEntityId() == event.entity.getEntityId())
                {
                    has = true;
                    ent.setLocationAndAngles(event.entity.posX, event.entity.posY, event.entity.posZ, 0F, 0F);
                    break;
                }
            }
            if(!has)
            {
                event.entity.worldObj.weatherEffects.add(event.entity);
            }
        }
    }
}
项目:MagicalRings    文件:BiomeDecorHandler.java   
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onWorldDecoration(DecorateBiomeEvent.Decorate event) {
    BiomeGenBase biome = event.world.getBiomeGenForCoords(event.chunkX, event.chunkZ);
    if (biome != null && isValidBiomeType(biome)) {
        if ((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT) && event.type == DecorateBiomeEvent.Decorate.EventType.FLOWERS) {
            for (int i = 0; i < ModLibs.manaFlowerQuantity; i++) {
                int x = event.chunkX + event.rand.nextInt(16) + 8;
                int z = event.chunkZ + event.rand.nextInt(16) + 8;
                int y = event.world.getTopSolidOrLiquidBlock(x, z);

                for (int j = 0; j < ModLibs.manaFlowerDensity; j++) {
                    int x1 = x + event.rand.nextInt(8) - event.rand.nextInt(8);
                    int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4);
                    int z1 = z + event.rand.nextInt(8) - event.rand.nextInt(8);

                    if (event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.manaFlower.canBlockStay(event.world, x1, y1, z1))
                        event.world.setBlock(x1, y1, z1, ModBlocks.manaFlower, event.rand.nextInt(3), 2);
                }
            }
        }
    }
}
项目:MyTown2    文件:ProtectionHandlers.java   
@SuppressWarnings("unchecked")
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent ev) {
    if (ev.entityPlayer.worldObj.isRemote || ev.isCanceled()) {
        return;
    }

    Resident res = MyTownUniverse.instance.getOrMakeResident(ev.entityPlayer);
    if(ev.entityPlayer.getHeldItem() != null) {
        ProtectionManager.checkUsage(ev.entityPlayer.getHeldItem(), res, ev.action, createBlockPos(ev), ev.face, ev);
    }
    if (!ev.isCanceled()) {
        ProtectionManager.checkBlockInteraction(res, new BlockPos(ev.x, ev.y, ev.z, ev.world.provider.dimensionId), ev.action, ev);
    }

    // Some things (Autonomous Activator) only care about these. So always deny them if the event is canceled.
    if (ev.isCanceled()) {
        ev.useBlock = Event.Result.DENY;
        ev.useItem = Event.Result.DENY;
    }
}
项目:QmunityLib    文件:BlockMultipart.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
@SideOnly(Side.CLIENT)
public void onDrawHighlight(DrawBlockHighlightEvent event) {

    try {
        if (!(event.player.worldObj.getBlock(event.target.blockX, event.target.blockY, event.target.blockZ) instanceof BlockMultipart))
            return;

        QMovingObjectPosition mop = retrace(event.player.worldObj, event.target.blockX, event.target.blockY, event.target.blockZ,
                RayTracer.instance().getStartVector(event.player), RayTracer.instance().getEndVector(event.player));
        if (mop == null)
            return;
        if (mop.getPart() == null || !(mop.getPart() instanceof IPartSelectableCustom))
            return;
        if (((IPartSelectableCustom) mop.getPart()).drawHighlight(mop, event.player, event.partialTicks))
            event.setCanceled(true);
    } catch (Exception ex) {
    }
}
项目:CustomThings    文件:LivingDropsHandler.java   
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onLivingDrop(LivingDropsEvent event)
{
    if (event.entityLiving instanceof EntityCreeper)
    {
        boolean foundRecord = false;
        Iterator<EntityItem> iter = event.drops.iterator();
        while (iter.hasNext())
        {
            EntityItem e = iter.next();
            if (e.getEntityItem().getItem() instanceof ItemRecord)
            {
                foundRecord = true;
            }
        }

        if (foundRecord)
        {
            addRandomRecordToDrops(event.drops);
        }
    }
}
项目:projectzulu1.7.10    文件:ChangeVanillaDrops.java   
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(LivingDropsEvent event)
{
    if (event.entity instanceof EntitySheep)
    {
        // DEBUG
        Optional<?> itemBlock = ItemList.muttonRaw;

        if (itemBlock.isPresent()) {
        ItemStack itemStackToDrop = new ItemStack((Item)itemBlock.get());

        event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, 

              event.entity.posY, event.entity.posZ, itemStackToDrop));
        }
    }
}
项目:TRHS_Club_Mod_2016    文件:ForgeInternalHandler.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onDimensionUnload(WorldEvent.Unload event)
{
    ForgeChunkManager.unloadWorld(event.world);
    if (event.world instanceof WorldServer)
        FakePlayerFactory.unloadWorld((WorldServer)event.world);
}
项目:NoteblockTweak    文件:NoteblockPlaceHandler.java   
@SubscribeEvent(priority = EventPriority.HIGH)
public void rightClick(PlayerInteractEvent event){
    if(event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() instanceof ItemNoteblockFork){
        if(Minecraft.getMinecraft().theWorld.getBlock(event.x, event.y, event.z) instanceof BlockNote){
            if(!event.entityPlayer.isSneaking()){
                event.setCanceled(true);
                TileEntityNote entity = (TileEntityNote) Minecraft.getMinecraft().theWorld.getTileEntity(event.x, event.y, event.z);
                Minecraft.getMinecraft().displayGuiScreen(new GuiSet(entity, Minecraft.getMinecraft().currentScreen));
            }
        }
    }
}
项目:Age-of-Kingdom    文件:KeyManager.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority= EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(InputEvent.KeyInputEvent event) {
    Minecraft mc = Minecraft.getMinecraft();
    World world = mc.theWorld;
    EntityPlayer player = mc.thePlayer;
    if(keys[0].isPressed()) {
        NetworkManager.sendToServer(new GuiAokMessage());
    }
    if(mc.gameSettings.keyBindChat.isPressed()) {
        player.closeScreen();
        player.openGui(AgeOfKingdom.INSTANCE, AgeOfKingdom.serverProxy.GUI_CHAT, world, (int) player.posX, (int) player.posY, (int) player.posZ);
    }
}
项目:Rival-Rebels-Mod    文件:RivalRebelsRenderOverlay.java   
@SubscribeEvent(priority = EventPriority.NORMAL)
public void eventHandler(RenderGameOverlayEvent event)
{
    if (rhodes != null)
    {
        renderRhodes(event, Minecraft.getMinecraft().thePlayer, rhodes);
    }
    renderItems(event);
}
项目:TweakCraft    文件:TweakCraftEventHandler.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void handleServerChat(ServerChatEvent evt) {
    if (!TweakCraft.config.allowChatFormatting) {
        return;
    }
    final String message = evt.component.getFormattedText();
    evt.component = new ChatComponentTranslation(message.replaceAll("\\\\&", ChatFormatCode.SYMBOL));
}
项目:WorldBorder-Forge    文件:MobSpawnListener.java   
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onCreatureSpawn(LivingSpawnEvent.CheckSpawn event)
{
    if ( isInsideBorder(event) )
        return;

    // CheckSpawn uses event result instead of cancellation
    event.setResult(LivingSpawnEvent.Result.DENY);
}