本文整理汇总了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);
}
}
示例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));
}
示例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;
}
}
示例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);
}
示例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);
}
}
}
}
示例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;
}
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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 );
}
}
示例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 );
}
}
示例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);
}
}