當前位置: 首頁>>代碼示例>>Java>>正文


Java EventPriority類代碼示例

本文整理匯總了Java中cpw.mods.fml.common.eventhandler.EventPriority的典型用法代碼示例。如果您正苦於以下問題:Java EventPriority類的具體用法?Java EventPriority怎麽用?Java EventPriority使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EventPriority類屬於cpw.mods.fml.common.eventhandler包,在下文中一共展示了EventPriority類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dropEvent

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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);
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:19,代碼來源:ServerEventHandler.java

示例2: updateSoulDrain

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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));
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:18,代碼來源:EventHandlerServer.java

示例3: entityColorRender

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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;
    }
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:25,代碼來源:EventHandlerClient.java

示例4: denyCraft

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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;
    }
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:17,代碼來源:TConEvents.java

示例5: gunRenderEvent

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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;
	}
}
 
開發者ID:TeamMonumental,項目名稱:FissionWarfare,代碼行數:21,代碼來源:GunRenderEvent.java

示例6: onServerChat

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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);
}
 
開發者ID:mads256c,項目名稱:BetterChat,代碼行數:18,代碼來源:EventHandler.java

示例7: onEvent

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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;
    }
  
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:19,代碼來源:ClientProxy.java

示例8: onEvent

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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;
    }
  
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:19,代碼來源:VersionChecker.java

示例9: onPlayerPearl

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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;
    }
}
 
開發者ID:RoyCurtis,項目名稱:WorldBorder-Forge,代碼行數:24,代碼來源:EnderPearlListener.java

示例10: onWorldDecoration

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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);
			}
		}
	}
}
 
開發者ID:gigabit101,項目名稱:PrimitiveCraft,代碼行數:23,代碼來源:WorldGenStones.java

示例11: onEvent

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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());
	}
}
 
開發者ID:PC-Logix,項目名稱:OpenFM,代碼行數:8,代碼來源:OpenFM.java

示例12: entityInteract

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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);
				}
			}
		}
	}
}
 
開發者ID:OreCruncher,項目名稱:ThermalRecycling,代碼行數:22,代碼來源:BreedingItemManager.java

示例13: tickEventEnd

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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();
  	}
	}
}
 
開發者ID:wildex999,項目名稱:TickDynamic,代碼行數:25,代碼來源:TickDynamicMod.java

示例14: gunRenderEvent

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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;
	}
}
 
開發者ID:TeamMonumental,項目名稱:FusionWarfare,代碼行數:19,代碼來源:GunRenderEvent.java

示例15: onBiomeDecoration

import cpw.mods.fml.common.eventhandler.EventPriority; //導入依賴的package包/類
@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);
            }
        }
    }
}
 
開發者ID:Dynious,項目名稱:Biota,代碼行數:20,代碼來源:TerrainEventHandler.java


注:本文中的cpw.mods.fml.common.eventhandler.EventPriority類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。