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