當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。