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


Java EventPriority.HIGHEST屬性代碼示例

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


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

示例1: dropEvent

@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,代碼行數:18,代碼來源:ServerEventHandler.java

示例2: updateSoulDrain

@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,代碼行數:17,代碼來源:EventHandlerServer.java

示例3: entityColorRender

@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,代碼行數:24,代碼來源:EventHandlerClient.java

示例4: onPlayerUsesBlock

@SubscribeEvent(priority = EventPriority.HIGHEST)
//make sure it gets trigered first to prevent handeling from other mods
public void onPlayerUsesBlock(PlayerInteractEvent event) {
	String key = "";
	if (event.world.isRemote)
		return;
	EntityPlayer player = event.entityPlayer;
	PlayerResearch research = PlayerResearch.get(player);
	if (player.getCurrentEquippedItem() != null)
		key = EurekaAPI.API.getKey(player.getCurrentEquippedItem());
	if (!research.isFinished(key) && !key.equals("")) {
		ItemStack stack = player.getCurrentEquippedItem().copy();
		stack.stackSize = 1;
		dropItems(event.world, event.x, event.y, event.z, EurekaAPI.API.getDrops(stack));
		if (event.entityPlayer.getCurrentEquippedItem().stackSize > 1)
			event.entityPlayer.getCurrentEquippedItem().stackSize--;
		else
			event.entityPlayer.destroyCurrentEquippedItem();
		event.setCanceled(true);
	}

	key = EurekaAPI.API.getKey(event.world.getBlock(event.x, event.y, event.z));
	if (key != null && !key.equals("") && !research.isFinished(key))
		event.setCanceled(true);
}
 
開發者ID:AEnterprise,項目名稱:Eureka,代碼行數:25,代碼來源:EventHandler.java

示例5: onEntitySpawn

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onEntitySpawn(EntityJoinWorldEvent event)
{
    if(event.entity.worldObj.isRemote && event.entity instanceof EntityMeteorite && FMLCommonHandler.instance().getEffectiveSide().isClient() && !event.entity.isDead)
    {
        event.setCanceled(true);
        if(!event.entity.worldObj.weatherEffects.contains(event.entity))
        {
            boolean has = false;
            for(int i = 0; i < event.entity.worldObj.weatherEffects.size(); i++)
            {
                Entity ent = (Entity)event.entity.worldObj.weatherEffects.get(i);
                if(ent instanceof EntityMeteorite && ent.getEntityId() == event.entity.getEntityId())
                {
                    has = true;
                    ent.setLocationAndAngles(event.entity.posX, event.entity.posY, event.entity.posZ, 0F, 0F);
                    break;
                }
            }
            if(!has)
            {
                event.entity.worldObj.weatherEffects.add(event.entity);
            }
        }
    }
}
 
開發者ID:iChun,項目名稱:ItFellFromTheSky,代碼行數:26,代碼來源:EventHandler.java

示例6: onPlayerInteract

@SuppressWarnings("unchecked")
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent ev) {
    if (ev.entityPlayer.worldObj.isRemote || ev.isCanceled()) {
        return;
    }

    Resident res = MyTownUniverse.instance.getOrMakeResident(ev.entityPlayer);
    if(ev.entityPlayer.getHeldItem() != null) {
        ProtectionManager.checkUsage(ev.entityPlayer.getHeldItem(), res, ev.action, createBlockPos(ev), ev.face, ev);
    }
    if (!ev.isCanceled()) {
        ProtectionManager.checkBlockInteraction(res, new BlockPos(ev.x, ev.y, ev.z, ev.world.provider.dimensionId), ev.action, ev);
    }

    // Some things (Autonomous Activator) only care about these. So always deny them if the event is canceled.
    if (ev.isCanceled()) {
        ev.useBlock = Event.Result.DENY;
        ev.useItem = Event.Result.DENY;
    }
}
 
開發者ID:MyEssentials,項目名稱:MyTown2,代碼行數:21,代碼來源:ProtectionHandlers.java

示例7: onDimensionUnload

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

示例8: handleServerChat

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void handleServerChat(ServerChatEvent evt) {
	if (!TweakCraft.config.allowChatFormatting) {
		return;
	}
	final String message = evt.component.getFormattedText();
	evt.component = new ChatComponentTranslation(message.replaceAll("\\\\&", ChatFormatCode.SYMBOL));
}
 
開發者ID:PrincessRTFM,項目名稱:TweakCraft,代碼行數:8,代碼來源:TweakCraftEventHandler.java

示例9: onCreatureSpawn

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

    // CheckSpawn uses event result instead of cancellation
    event.setResult(LivingSpawnEvent.Result.DENY);
}
 
開發者ID:RoyCurtis,項目名稱:WorldBorder-Forge,代碼行數:9,代碼來源:MobSpawnListener.java

示例10: 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:RoyCurtis,項目名稱:WorldBorder-Forge,代碼行數:9,代碼來源:MobSpawnListener.java

示例11: onBlockPlace

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onBlockPlace(BlockEvent.PlaceEvent event)
{
    if ( isInsideBorder(event.world, event.x, event.z) )
        return;

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

示例12: onMultiBlockPlace

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onMultiBlockPlace(BlockEvent.MultiPlaceEvent event)
{
    if ( isInsideBorder(event.world, event.x, event.z) )
        return;

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

示例13: onWorldLoad

/********************************************************************************
 * Methods - Forge Events
 ********************************************************************************/

@SubscribeEvent( priority=EventPriority.HIGHEST )
public void onWorldLoad( WorldEvent.Load event )
{
	if( this.owners == null )
	{
		this.owners = LimitedBlockOwners.get( event.world );
	}
}
 
開發者ID:DerOli82,項目名稱:LimitedResources,代碼行數:12,代碼來源:BlockPlacingEvent.java

示例14: onEntityConstructing

@SubscribeEvent( priority=EventPriority.HIGHEST )
 public void onEntityConstructing( EntityConstructing event )
 {
 	//Register PlayerPlacedBlocks Entity
 	if( ( event.entity instanceof EntityPlayer ) && 
( LimitedBlockPlayer.get( (EntityPlayer) event.entity ) == null ) )
 	{
 		LimitedBlockPlayer.register( (EntityPlayer) event.entity );
 	}
 }
 
開發者ID:DerOli82,項目名稱:LimitedResources,代碼行數:10,代碼來源:BlockPlacingEvent.java

示例15: onRespawnEvent

@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onRespawnEvent(PlayerRespawnEvent event) 
{
	if (event.isCancelable())
		return;
	
	if(!event.player.capabilities.allowEdit)
	{
		event.player.setGameType(GameType.SURVIVAL);
	}
}
 
開發者ID:gigabit101,項目名稱:BuildcentricTweeks,代碼行數:11,代碼來源:RespawnEvent.java


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