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