当前位置: 首页>>代码示例>>Java>>正文


Java EventPriority.NORMAL属性代码示例

本文整理汇总了Java中cpw.mods.fml.common.eventhandler.EventPriority.NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Java EventPriority.NORMAL属性的具体用法?Java EventPriority.NORMAL怎么用?Java EventPriority.NORMAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在cpw.mods.fml.common.eventhandler.EventPriority的用法示例。


在下文中一共展示了EventPriority.NORMAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEvent

@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,代码行数:18,代码来源:ClientProxy.java

示例2: onEvent

@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,代码行数:18,代码来源:VersionChecker.java

示例3: onEvent

@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,代码行数:7,代码来源:OpenFM.java

示例4: entityInteract

@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,代码行数:21,代码来源:BreedingItemManager.java

示例5: playerAttackEvent

/**
 * 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;
}
 
开发者ID:VapourDrive,项目名称:HarderStart,代码行数:24,代码来源:HS_PlayerAttackEntity.java

示例6: onRenderExperienceBar

@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);
	}
}
 
开发者ID:TheDarkEra,项目名称:TheDarkEra,代码行数:25,代码来源:GuiManaBar.java

示例7: on

@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));
        }*/
    }
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:17,代码来源:EventHandlerGolem.java

示例8: on

@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);
        }
    }
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:23,代码来源:EventHandlerWorld.java

示例9: onRenderExperienceBar

@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);
		}
	}
}
 
开发者ID:hanetzer,项目名称:SecureCraftProtect,代码行数:25,代码来源:SCPGuiBlink.java

示例10: onEvent

@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));
    	}
    }
}
 
开发者ID:soultek101,项目名称:projectzulu1.7.10,代码行数:17,代码来源:ChangeVanillaDrops.java

示例11: onEvent

@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);
    }
}
 
开发者ID:jackey8616,项目名称:Age-of-Kingdom,代码行数:14,代码来源:KeyManager.java

示例12: eventHandler

@SubscribeEvent(priority = EventPriority.NORMAL)
public void eventHandler(RenderGameOverlayEvent event)
{
	if (rhodes != null)
	{
		renderRhodes(event, Minecraft.getMinecraft().thePlayer, rhodes);
	}
	renderItems(event);
}
 
开发者ID:rodolphito,项目名称:Rival-Rebels-Mod,代码行数:9,代码来源:RivalRebelsRenderOverlay.java

示例13: onEvent

@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onEvent(final PopulateChunkEvent.Pre event) {

	final Chunk chunk = event.world.getChunkFromChunkCoords(event.chunkX, event.chunkZ);
	final Block fromBlock = Blocks.redstone_ore;
	final Block toBlock = BlockManager.energeticRedstone;

	for (final ExtendedBlockStorage storage : chunk.getBlockStorageArray()) {
		if (storage != null) {
			for (int x = 0; x < 16; ++x) {
				for (int y = 0; y < 16; ++y) {
					for (int z = 0; z < 16; ++z) {
						final Block theBlock = storage.getBlockByExtId(x, y, z);
						if (theBlock == fromBlock) {
							if(event.rand.nextInt(REPLACE_CHANCE) == 0) {
								storage.func_150818_a(x, y, z, toBlock);
								storage.setExtBlocklightValue(x, y, z, toBlock.getLightValue());
							}
						}
					}
				}
			}
		}
	}
	
	chunk.setChunkModified();
}
 
开发者ID:OreCruncher,项目名称:ThermalRecycling,代码行数:27,代码来源:EnergeticRedstoneOreHandler.java

示例14: addVanillaDrop

/**
 * Simply causes sticks to fall from some leaves Oredictionaried leaves that
 * is
 * 
 * @param event
 */
@SubscribeEvent(priority = EventPriority.NORMAL)
public void addVanillaDrop(BlockEvent.HarvestDropsEvent event)
{
	if (event.harvester != null && !event.harvester.capabilities.isCreativeMode && !event.harvester.worldObj.isRemote
			&& !event.isCanceled())
	{
		Random random = new Random();

		if (OreDictionary.itemMatches(new ItemStack(Blocks.leaves), new ItemStack(event.block), true))
		{
			int option = random.nextInt(16);
			if (option > 12)
			{
				event.drops.add(new ItemStack(Items.stick));
			}
			else if (event.harvester.getCurrentEquippedItem() == null && option < 10)
			{
				event.drops.add(new ItemStack(HS_Items.food_cricket));
			}
		}
		else if (event.block == Blocks.dirt || event.block == Blocks.grass)
		{
			if (event.harvester.getCurrentEquippedItem() == null && random.nextFloat() > 0.5F)
			{
				event.drops.add(new ItemStack(HS_Items.food_grub));
			}

		}
	}
	return;
}
 
开发者ID:VapourDrive,项目名称:HarderStart,代码行数:37,代码来源:HS_AddVanillaDrop.java

示例15: itemToolTipAddition

/**
 * Adds things to the item tooltips currently adds little plug for a stick
 * being a basic tool as well as ore dictionary listings TODO make
 * configurable and pretty things up
 * 
 * @param event
 */
@SubscribeEvent(priority = EventPriority.NORMAL)
public void itemToolTipAddition(ItemTooltipEvent event)
{
	ItemStack stack = event.itemStack;

	if (stack != null)
	{
		if (OreDictionary.itemMatches(new ItemStack(Items.stick), stack, true))
		{
			event.toolTip.add("Rudimentary weapon and tool");
		}
		event.toolTip.add(stack.getItem().getUnlocalizedName() + " " + stack.getItemDamage());

		int[] oreIDs = OreDictionary.getOreIDs(stack);
		if (oreIDs.length > 0)
		{
			String oreDictionary = "OreDictionary:";
			for (int i = 0; i < oreIDs.length; i++)
			{
				oreDictionary = oreDictionary + " " + OreDictionary.getOreName(oreIDs[i]);
			}
			event.toolTip.add(oreDictionary);
		}

		Set<String> tooltags = stack.getItem().getToolClasses(stack);
		if (!tooltags.isEmpty())
		{
			event.toolTip.add("ToolTypes: " + tooltags.toString());
		}
	}

	return;
}
 
开发者ID:VapourDrive,项目名称:HarderStart,代码行数:40,代码来源:HS_ItemInfoAdditions.java


注:本文中的cpw.mods.fml.common.eventhandler.EventPriority.NORMAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。