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