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


Java EventPriority.HIGHEST屬性代碼示例

本文整理匯總了Java中net.minecraftforge.fml.common.eventhandler.EventPriority.HIGHEST屬性的典型用法代碼示例。如果您正苦於以下問題:Java EventPriority.HIGHEST屬性的具體用法?Java EventPriority.HIGHEST怎麽用?Java EventPriority.HIGHEST使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraftforge.fml.common.eventhandler.EventPriority的用法示例。


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

示例1: onLivingAttack

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onLivingAttack(LivingAttackEvent event)
{
	/*
	 * Player attacks a monster OR another player
	 */
	if (event.getSource().getTrueSource() instanceof EntityPlayer && !event.getSource().getTrueSource().getEntityWorld().isRemote)
	{
		EntityPlayer player = (EntityPlayer) event.getSource().getTrueSource();
		EntityLivingBase enemy = event.getEntityLiving();
		ItemStack stack = player.inventory.getCurrentItem();
		PlayerInformation playerInfo = (PlayerInformation) player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);
		
		if (playerInfo != null && stack != null && stack.getItem() instanceof ItemSword && !(stack.getItem() instanceof ItemLEAdvancedMelee))
		{
			NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
			
			if (playerInfo.getPlayerLevel() >= nbt.getInteger("Level"))
			{
				useWeaponAttributes(event.getAmount(), player, enemy, stack, nbt);
			}
		}
	}
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:24,代碼來源:EventLivingHurtAttack.java

示例2: onItemTooltip

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onItemTooltip(ItemTooltipEvent event)
{
	ArrayList<String> tooltip = (ArrayList<String>) event.getToolTip();
	ItemStack stack = event.getItemStack();
	NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
	
	if (event.getEntityPlayer() != null)
	{
		PlayerInformation info = (PlayerInformation) event.getEntityPlayer().getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);
		
		if (info != null && (stack.getItem() instanceof ItemSword || stack.getItem() instanceof ItemArmor || stack.getItem() instanceof ItemLEMagical || stack.getItem() instanceof ItemLEBauble))
		{
			Rarity rarity = Rarity.getRarity(nbt);
			
			if (rarity != Rarity.DEFAULT)
			{
				if (stack.getItem() instanceof ItemSword) drawMelee(tooltip, stack, nbt, event.getEntityPlayer(), info);
				else if (stack.getItem() instanceof ItemArmor) drawArmor(tooltip, stack, nbt, event.getEntityPlayer(), info);
				else if (stack.getItem() instanceof ItemLEMagical) drawMagical(tooltip, stack, nbt, event.getEntityPlayer(), info);
				else if (stack.getItem() instanceof ItemLEBauble) drawBauble(tooltip, stack, nbt, event.getEntityPlayer(), info);
			}
		}
	}
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:25,代碼來源:EventItemTooltip.java

示例3: CommandEvents

@SubscribeEvent(priority = EventPriority.HIGHEST)
  public void CommandEvents(CommandEvent evt) {
	
	if(Main.debug==1)System.out.println(evt.getSender().getName() + " called Command " + evt.getSender().toString());

	
	if(evt.getSender() instanceof EntityPlayer){
	if(!Main.logged.contains(evt.getSender().getName())){
		//System.out.println(evt.getCommand().getCommandName().toString());
		if(!evt.getCommand().getCommandName().toString().contains("login") && !evt.getCommand().getCommandName().toString().contains("register")){
		evt.setCanceled(true);
		if(Main.passwords.containsKey(evt.getSender().getName())){
			evt.getSender().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("loginmessage")));
		} else {
		evt.getSender().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("registermessage")));
		}
		} 
	}
	}
}
 
開發者ID:Fungie2134,項目名稱:AuthMod,代碼行數:20,代碼來源:CommandEvents.java

示例4: HarvestDropsEvent

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void HarvestDropsEvent(BlockEvent.HarvestDropsEvent e){
    try {
        if (e != null && e.getHarvester() == null && !e.getDrops().isEmpty() && ((e.getState().getBlock().equals(Blocks.LEAVES))
                || e.getState().getBlock().equals(Blocks.LEAVES2)) && !e.getWorld().isRemote) {
            Block block = Block.getBlockFromItem(e.getDrops().get(0).getItem());
            int meta = e.getDrops().get(0).getMetadata();
            BlockPos pos = findGround(e.getWorld(), e.getPos());
            if (pos != null && e.getWorld() != null) {
                e.getWorld().setBlockState(pos, block.getStateFromMeta(meta));
                deleteCopySapling(e.getWorld(), pos, Item.getItemFromBlock(block));
            }
        }
    }catch(Throwable throwable){
        System.out.println("    EXCEPTION FOUND IN EVENT TWEAKS FOREST REPLANTING: PLEASE REPORT LOGS TO EVENT TWEAKS WITH INFORMATION ON REPRODUCING");
        throwable.printStackTrace();
    }
}
 
開發者ID:baileyholl,項目名稱:Event-Tweaks,代碼行數:18,代碼來源:ForestEventHandlers.java

示例5: itemFishedEvent

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void itemFishedEvent(ItemFishedEvent event) {
    ItemStack stack = event.getEntityPlayer().getHeldItemMainhand();

    if (!stack.isEmpty()) {
        NBTTagList nbtList = stack.getEnchantmentTagList();
        for (NBTBase nbt : nbtList) {
            if (((NBTTagCompound) nbt).getInteger("id") == Enchantment.getEnchantmentID(GSEnchantment.CURSE_BROKEN_HOOK)) {
                if (EnchantmentBrokenHookCurse.cancelFishing()) {
                    event.setCanceled(true);
                }
                break;
            }
        }
    }
}
 
開發者ID:NightKosh,項目名稱:Gravestone-mod-Extended,代碼行數:16,代碼來源:GSEventsHandler.java

示例6: onModelBake

@SubscribeEvent (priority = EventPriority.HIGHEST)
public void onModelBake(ModelBakeEvent event) {

    IModel missingIModel = ModelLoaderRegistry.getMissingModel();
    IBakedModel missingModel = missingIModel.bake(missingIModel.getDefaultState(), DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter);
    Map<IModel, IBakedModel> bakedModels = new HashMap<>();
    HashMultimap<IModel, ModelResourceLocation> models = HashMultimap.create();
    Multimaps.invertFrom(Multimaps.forMap(toBake), models);

    ProgressBar bar = ProgressManager.push("CCL ModelLoading: Baking", models.keySet().size());

    for (IModel model : models.keySet()) {
        bar.step(String.format("[%s]", Joiner.on(", ").join(models.get(model))));
        if (model == missingIModel) {
            bakedModels.put(model, missingModel);
            continue;
        }
        bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter));
    }
    ProgressManager.pop(bar);

    for (Entry<ModelResourceLocation, IModel> entry : toBake.entrySet()) {
        event.getModelRegistry().putObject(entry.getKey(), bakedModels.get(entry.getValue()));
    }

}
 
開發者ID:TheCBProject,項目名稱:CodeChickenLib,代碼行數:26,代碼來源:CCBlockStateLoader.java

示例7: PlayerInteraction

@SubscribeEvent(priority = EventPriority.HIGHEST)
  public void PlayerInteraction(LivingHurtEvent evt) {
	if(Main.debug==1)System.out.println(evt.getEntity().getName() + " called PlayerHurt  " + evt.getEntity().toString());
	
	if(evt.getEntity() instanceof EntityPlayer && !Main.logged.contains(evt.getEntity().getName())){
		evt.setCanceled(true);
	}
}
 
開發者ID:Fungie2134,項目名稱:AuthMod,代碼行數:8,代碼來源:PlayerHurt.java

示例8: onPlayerRespawn

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerRespawn(PlayerRespawnEvent event)
{
	if(stackMap.containsKey(event.player.getUniqueID()))
	{
		event.player.getEntityData().setTag("harshenInventory", stackMap.get(event.player.getUniqueID()).serializeNBT());
		for(int i = 0; i < stackMap.get(event.player.getUniqueID()).getSlots(); i++)
			if(stackMap.get(event.player.getUniqueID()).getStackInSlot(i).getItem() instanceof IHarshenProvider)
				((IHarshenProvider)stackMap.get(event.player.getUniqueID()).getStackInSlot(i).getItem()).onAdd(event.player, i);

	}
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:12,代碼來源:HandlerHarshenInventory.java

示例9: onSpecialSpawn

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onSpecialSpawn(LivingSpawnEvent.SpecialSpawn event)
{
    if ( isInsideBorder(event) )
        return;

    // SpecialSpawn uses event cancellation instead of result
    event.setCanceled(true);
}
 
開發者ID:abused,項目名稱:World-Border,代碼行數:9,代碼來源:MobSpawnListener.java

示例10: onDimensionUnload

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onDimensionUnload(WorldEvent.Unload event)
{
    ForgeChunkManager.unloadWorld(event.getWorld());
    if (event.getWorld() instanceof WorldServer)
        FakePlayerFactory.unloadWorld((WorldServer) event.getWorld());
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:7,代碼來源:ForgeInternalHandler.java

示例11: onOpenGui

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onOpenGui(GuiOpenEvent event) {
	Minecraft mc = Minecraft.getMinecraft();
	if (mc.player != null && mc.player.getHealth() <= 0f) {
		mc.player.setSneaking(false);
		if (event.getGui() instanceof GuiChat && mc.gameSettings.keyBindSneak.isKeyDown()) {
			event.setGui(new GuiChat("/team "));
		}
	}
}
 
開發者ID:blay09,項目名稱:HardcoreRevival,代碼行數:10,代碼來源:TeamUpAddon.java

示例12: onBlockPlace

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onBlockPlace(BlockEvent.PlaceEvent event)
{
    if ( isInsideBorder(event.getWorld(), event.getPos().getX(), event.getPos().getZ()) )
        return;

    event.setResult(BlockEvent.Result.DENY);
    event.setCanceled(true);
}
 
開發者ID:abused,項目名稱:World-Border,代碼行數:9,代碼來源:BlockPlaceListener.java

示例13: onBreakProgress

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onBreakProgress(PlayerEvent.BreakSpeed event) {
	EntityPlayer player = event.getEntityPlayer();
	if (player != null && player.getHealth() <= 0f) {
		event.setNewSpeed(0f);
	}
}
 
開發者ID:blay09,項目名稱:HardcoreRevival,代碼行數:7,代碼來源:RestrictionHandler.java

示例14: ChatEvent

@SubscribeEvent(priority = EventPriority.HIGHEST)
  public void ChatEvent(ServerChatEvent evt) {
	
	if(Main.debug==1)System.out.println(evt.getPlayer().getName() + " called ChatEvent");

	
	if(evt.getPlayer() instanceof EntityPlayer && !Main.logged.contains(evt.getPlayer().getName()) && Integer.parseInt((String) Main.config.get("nochat")) == 1){
		evt.setCanceled(true);
		if(Main.passwords.containsKey(evt.getPlayer().getName())){
		evt.getPlayer().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("loginmessage")));
	} else {
	evt.getPlayer().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("registermessage")));
	}
	}
}
 
開發者ID:Fungie2134,項目名稱:AuthMod,代碼行數:15,代碼來源:ChatEvent.java

示例15: EntityEvents

@SubscribeEvent(priority = EventPriority.HIGHEST)
 public void EntityEvents(BlockEvent.PlaceEvent evt) {
if(Main.debug==1)System.out.println(evt.getPlayer().getName() + " called PlaceEvent");

if(!Main.logged.contains(evt.getPlayer().getName())){
	evt.setCanceled(true);
	}
		}
 
開發者ID:Fungie2134,項目名稱:AuthMod,代碼行數:8,代碼來源:EntityEvents.java


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