当前位置: 首页>>代码示例>>Java>>正文


Java EventPriority类代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.eventhandler.EventPriority的典型用法代码示例。如果您正苦于以下问题:Java EventPriority类的具体用法?Java EventPriority怎么用?Java EventPriority使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EventPriority类属于net.minecraftforge.fml.common.eventhandler包,在下文中一共展示了EventPriority类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLivingAttack

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@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,代码行数:25,代码来源:EventLivingHurtAttack.java

示例2: onItemTooltip

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@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,代码行数:26,代码来源:EventItemTooltip.java

示例3: onInitGuiPost

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onInitGuiPost(GuiScreenEvent.InitGuiEvent.Post event)
{
    if(!hasShownFirstGui)
    {
        hasShownFirstGui = true;

        //Add the layer renderers
        Render renderer = Minecraft.getMinecraft().getRenderManager().getEntityClassRenderObject(EntityLlama.class);
        if(renderer instanceof RenderLlama)
        {
            RenderLlama renderLlama = (RenderLlama)renderer;
            renderLlama.addLayer(new LayerFancyLlama(renderLlama));
        }
    }
}
 
开发者ID:iChun,项目名称:BetterThanLlamas,代码行数:17,代码来源:BetterThanLlamas.java

示例4: placeKiln

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority=EventPriority.HIGH)
public void placeKiln(PlayerInteractEvent.RightClickBlock event){
	if(event.getWorld().getBlockState(event.getPos()).getBlock()==BlocksRegistry.potteryKiln){
		event.setUseBlock(Result.ALLOW);
	}else if(!event.isCanceled()&&event.getEntityPlayer().isSneaking()&&PotteryKilnRecipe.isValidInput(event.getItemStack())){
		if(event.getFace()==EnumFacing.UP&&event.getWorld().getBlockState(event.getPos()).isSideSolid(event.getWorld(), event.getPos(), EnumFacing.UP)&&
				event.getWorld().getBlockState(event.getPos().offset(EnumFacing.UP)).getBlock().isReplaceable(event.getWorld(), event.getPos().offset(EnumFacing.UP))){
			if(!event.getWorld().isRemote){
				event.getWorld().setBlockState(event.getPos().offset(EnumFacing.UP), BlocksRegistry.potteryKiln.getDefaultState());
				TilePotteryKiln tile=((TilePotteryKiln)event.getWorld().getTileEntity(event.getPos().offset(EnumFacing.UP)));
				event.getEntityPlayer().setHeldItem(event.getHand(), tile.pottery.insertItem(0, event.getItemStack(), false));
				event.getWorld().playSound(null, event.getPos(), SoundEvents.BLOCK_GRAVEL_PLACE, SoundCategory.BLOCKS, 1F, 1F);
				event.getWorld().notifyBlockUpdate(event.getPos().offset(EnumFacing.UP), BlocksRegistry.potteryKiln.getDefaultState(), BlocksRegistry.potteryKiln.getDefaultState(), 2);
			}
			event.setUseBlock(Result.DENY);
			event.setUseItem(Result.DENY);
		}
	}
}
 
开发者ID:EnderiumSmith,项目名称:CharcoalPit,代码行数:20,代码来源:PileIgnitr.java

示例5: onEvent

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public static void onEvent(KeyInputEvent event) {
	Minecraft mc = Minecraft.getMinecraft();
	EntityPlayer player = mc.player;

	CartCapability entityData = player.getCapability(Currency.CART_DATA, null);

	boolean isEmpty = true;

	if (entityData != null && entityData.getCart() != null) {
		for (ItemStack stack : entityData.getCart()) {
			if (!stack.isEmpty()) {
				isEmpty = false;
			}
		}
	}

	if (!isEmpty && openList.isPressed()) {
		Minecraft.getMinecraft().player.openGui(Currency.INSTANCE, 5, mc.world, (int) player.posX, (int) player.posY, (int) player.posZ);
	}
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:23,代码来源:KeybindHandler.java

示例6: CommandEvents

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@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,代码行数:21,代码来源:CommandEvents.java

示例7: PlayerLoggedOut

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
 public void PlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent evt) {

if(Main.debug==1)System.out.println(evt.player.getName() + " called PlayentLoggedOut");
MinecraftServer minecraftServer = FMLServerHandler.instance().getServer();
String brut = minecraftServer.getPlayerList().getPlayerByUsername(evt.player.getName()).connection.getNetworkManager().getRemoteAddress().toString().replaceAll("/", "");
int lenght = brut.length();
brut = brut.substring(0, lenght-6);


if(Integer.parseInt((String) Main.config.get("iplogin")) > 0 && !Main.ips.containsKey(brut) && Main.logged.contains(evt.player.getName())){
	Main.ips.put(brut, 0);
	}


Main.logged.remove(evt.player.getName());
Main.posX.remove(evt.player.getName());
Main.posY.remove(evt.player.getName());
Main.posZ.remove(evt.player.getName());
Main.time.remove(evt.player.getName());
}
 
开发者ID:Fungie2134,项目名称:AuthMod,代码行数:22,代码来源:PlayerLoggedOut.java

示例8: onHeal

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public static void onHeal(LivingHealEvent event) {
    EntityLivingBase entity = event.getEntityLiving();
    if (!entity.hasCapability(CapabilityExtendedHealthSystem.INSTANCE, null))
        return;
    event.setCanceled(true);
    if (!FirstAid.activeHealingConfig.allowOtherHealingItems)
        return;
    float amount = event.getAmount();
    //Hacky shit to reduce vanilla regen
    if (FirstAid.activeHealingConfig.allowNaturalRegeneration && Arrays.stream(Thread.currentThread().getStackTrace()).anyMatch(stackTraceElement -> stackTraceElement.getClassName().equals(FoodStats.class.getName())))
        amount = amount * (float) FirstAid.activeHealingConfig.naturalRegenMultiplier;
    else
        amount = amount * (float) FirstAid.activeHealingConfig.otherRegenMultiplier;
    HealthDistribution.distributeHealth(amount, (EntityPlayer) entity, true);
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:17,代码来源:EventHandler.java

示例9: onWitherBoneHarvestEvent

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onWitherBoneHarvestEvent(BlockEvent.HarvestDropsEvent event) {
	if (event.getHarvester() == null) {
		return;
	}

	EntityPlayer player = event.getHarvester();
	ItemStack stack = player.getHeldItemMainhand();

	boolean flag = false;

	if (stack.getItem() instanceof IHaftTool) {
		if (IHaftTool.getHaftMat(stack) == ModMaterials.HAFT_WITHER_BONE) {
			flag = true;
		}
	}

	if (flag) {
		if (player.dimension != DimensionType.NETHER.getId()) {
			stack.damageItem(7, player);
		}
	}
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:24,代码来源:SpecialToolAbilityHandler.java

示例10: onGuiKeyboardEvent

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onGuiKeyboardEvent(GuiScreenEvent.KeyboardInputEvent.Post event) {
	if (Keyboard.getEventKeyState()) {
		int eventKey = Keyboard.getEventKey();
		if (KeyBindings.TOGGLE.isActiveAndMatches(eventKey)) {
			Config.toggleEnabled();
			event.setCanceled(true);
		} else if (KeyBindings.ZOOM_IN.isActiveAndMatches(eventKey)) {
			Config.increaseZoom();
			event.setCanceled(true);
		} else if (KeyBindings.ZOOM_OUT.isActiveAndMatches(eventKey)) {
			Config.decreaseZoom();
			event.setCanceled(true);
		}
	}
}
 
开发者ID:mezz,项目名称:ItemZoom,代码行数:17,代码来源:EventHandler.java

示例11: onItemStackTooltip

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onItemStackTooltip(RenderTooltipEvent.Pre event) {
	if (!Config.isToggledEnabled() && !isEnableKeyHeld()) {
		return;
	}
	ItemStack itemStack = event.getStack();
	//noinspection ConstantConditions
	if (itemStack == null || itemStack.isEmpty()) {
		return;
	}
	if (Config.isJeiOnly() && !ItemStack.areItemStacksEqual(itemStack, JeiCompat.getStackUnderMouse())) {
		return;
	}

	Minecraft minecraft = Minecraft.getMinecraft();
	GuiScreen currentScreen = minecraft.currentScreen;
	if (currentScreen instanceof GuiContainer) {
		GuiContainer guiContainer = (GuiContainer) currentScreen;
		renderZoomedStack(itemStack, guiContainer, minecraft);
	}
}
 
开发者ID:mezz,项目名称:ItemZoom,代码行数:22,代码来源:EventHandler.java

示例12: onTick

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onTick(TickEvent.RenderTickEvent event) {
    if (TextDisplayerMod.getInstance().getWebsiteUtils().isDisabled()) return;

    boolean isClickedLeft = Mouse.isButtonDown(0);
    if (isClickedLeft != this.lastLeft) {
        this.lastLeft = isClickedLeft;
        if (isClickedLeft) {
            this.leftClicks.add(System.currentTimeMillis());
        }
    }

    boolean isClickedRight = Mouse.isButtonDown(1);
    if (isClickedRight != this.lastRight) {
        this.lastRight = isClickedRight;
        if (isClickedRight) {
            this.rightClicks.add(System.currentTimeMillis());
        }
    }
}
 
开发者ID:boomboompower,项目名称:TextDisplayer,代码行数:21,代码来源:CPSParser.java

示例13: craftItem

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void craftItem(net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemCraftedEvent event) {
	ItemStack withPattern=ItemStack.EMPTY;
	ItemStack noPattern=ItemStack.EMPTY;
	for(int i=0; i<event.craftMatrix.getSizeInventory();i++){
		ItemStack stack=event.craftMatrix.getStackInSlot(i);
		if(!stack.isEmpty() && stack.getItem() instanceof ItemBanner){
			if(TileEntityBanner.getPatterns(stack)>0){
				withPattern=stack;
			}
			else{
				noPattern=stack;
			}
			if(!withPattern.isEmpty()&&!noPattern.isEmpty()){
				withPattern.shrink(1);
			}
		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:20,代码来源:TF2EventsCommon.java

示例14: onPlayerPearl

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onPlayerPearl(EnderTeleportEvent event)
{
    if ( !(event.getEntityLiving() instanceof EntityPlayerMP) )
        return;

    if ( Config.getKnockBack() == 0.0 || !Config.getDenyEnderpearl() )
        return;

    EntityPlayerMP player = (EntityPlayerMP) event.getEntityLiving();
    Log.trace( "Caught pearl teleport event by %s", player.getDisplayName() );

    Location target = new Location(event, player);
    Location newLoc = BorderCheck.checkPlayer(player, target, true, true);

    if (newLoc != null)
    {
        event.setCanceled(true);
        event.setTargetX(newLoc.posX);
        event.setTargetY(newLoc.posY);
        event.setTargetZ(newLoc.posZ);
    }
}
 
开发者ID:abused,项目名称:World-Border,代码行数:24,代码来源:EnderPearlListener.java

示例15: onInitGuiPost

import net.minecraftforge.fml.common.eventhandler.EventPriority; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onInitGuiPost(GuiScreenEvent.InitGuiEvent.Post event)
{
    if(!hasShownFirstGui)
    {
        hasShownFirstGui = true;

        //Add the layer renderers
        Render renderer = Minecraft.getMinecraft().getRenderManager().getEntityClassRenderObject(EntityRabbit.class);
        if(renderer instanceof RenderRabbit)
        {
            RenderRabbit renderRabbit = (RenderRabbit)renderer;
            renderRabbit.addLayer(new LayerFancyBunny(renderRabbit));
        }
    }
}
 
开发者ID:iChun,项目名称:Better-Than-Bunnies,代码行数:17,代码来源:BetterThanBunnies.java


注:本文中的net.minecraftforge.fml.common.eventhandler.EventPriority类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。