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


Java PlayerInteractEvent.getItemStack方法代碼示例

本文整理匯總了Java中net.minecraftforge.event.entity.player.PlayerInteractEvent.getItemStack方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerInteractEvent.getItemStack方法的具體用法?Java PlayerInteractEvent.getItemStack怎麽用?Java PlayerInteractEvent.getItemStack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.event.entity.player.PlayerInteractEvent的用法示例。


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

示例1: onBlockInteract

import net.minecraftforge.event.entity.player.PlayerInteractEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onBlockInteract(PlayerInteractEvent event) {
	cachedItem = event.getItemStack();
	cachedBlockPos = event.getPos();
	IBlockState state = Minecraft.getMinecraft().theWorld.getBlockState(event.getPos());
	Material mat = state.getMaterial();
	cachedVariant = state.getBlock().getMetaFromState(state);
	// we use this to detect the material of a broken block, so we want to ignore air, because otherwise this would
	// always be set to air at the point we handle a block break
	if (mat != Material.AIR) {
		cachedMaterial = mat;
	}
}
 
開發者ID:Maxopoly,項目名稱:OreLogger,代碼行數:14,代碼來源:Listener.java

示例2: playerInteractEvent

import net.minecraftforge.event.entity.player.PlayerInteractEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void playerInteractEvent(PlayerInteractEvent event)
{
    EntityPlayer player = event.getEntityPlayer();
    ItemStack stack = event.getItemStack();
    if (stack.isEmpty() || !Helper.shouldCare(player)) return;
    if (GlobalBanList.isBanned(player.dimension, stack))
    {
        player.sendStatusMessage(new TextComponentString(ItemBlacklist.message), true);
        if (ItemBlacklist.log) ItemBlacklist.getLogger().info("{} tried to use {} at {} ({})", player.getName(), stack.getDisplayName(), event.getPos(), event.getFace());
        if (event.isCancelable())
            event.setCanceled(true);
        GlobalBanList.process(player.dimension, player.inventory);
    }
}
 
開發者ID:DoubleDoorDevelopment,項目名稱:ItemBlacklist,代碼行數:16,代碼來源:ServerEventHandlers.java

示例3: UseOffhandItemEvent

import net.minecraftforge.event.entity.player.PlayerInteractEvent; //導入方法依賴的package包/類
public UseOffhandItemEvent(PlayerInteractEvent event){
    super(event);
    this.event = event;
    this.offhand = event.getItemStack();
    this.swingOffhand = onBlock();
}
 
開發者ID:Mine-and-blade-admin,項目名稱:Battlegear2,代碼行數:7,代碼來源:PlayerEventChild.java


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