当前位置: 首页>>代码示例>>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;未经允许,请勿转载。