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


Java PlayerInteractEvent.RightClickEmpty方法代码示例

本文整理汇总了Java中net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerInteractEvent.RightClickEmpty方法的具体用法?Java PlayerInteractEvent.RightClickEmpty怎么用?Java PlayerInteractEvent.RightClickEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.entity.player.PlayerInteractEvent的用法示例。


在下文中一共展示了PlayerInteractEvent.RightClickEmpty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPlayerInteract

import net.minecraftforge.event.entity.player.PlayerInteractEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent event) {
	EntityPlayer player = event.getEntityPlayer();
	if (player != null && player.getHealth() <= 0f) {
		if (!(event instanceof PlayerInteractEvent.RightClickEmpty || event instanceof PlayerInteractEvent.LeftClickEmpty)) {
			event.setCanceled(true);
		}
	}
}
 
开发者ID:blay09,项目名称:HardcoreRevival,代码行数:10,代码来源:RestrictionHandler.java

示例2: onRightClick

import net.minecraftforge.event.entity.player.PlayerInteractEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onRightClick(PlayerInteractEvent event) {
    if(event.getEntityPlayer().equals(Minecraft.getMinecraft().player) &&
            (event instanceof PlayerInteractEvent.RightClickBlock ||
            event instanceof PlayerInteractEvent.RightClickEmpty ||
            event instanceof PlayerInteractEvent.RightClickItem)) {
        if(ClientProxy.renderHelper.placePreview()) {
            event.setCancellationResult(EnumActionResult.FAIL);
            if(event.isCancelable()) {
                event.setCanceled(true);
            }
        }
    }
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:15,代码来源:SelectionBoxRenderHelper.java

示例3: onClickAir

import net.minecraftforge.event.entity.player.PlayerInteractEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onClickAir(PlayerInteractEvent.RightClickEmpty event) {
    EntityPlayer player = event.getEntityPlayer();
    PossessivePlayer possessivePlayer = PossessHandler.get(player);
    if (possessivePlayer != null) {
        if (possessivePlayer.isPossessing() && possessivePlayer.getPossessAnimation() >= PossessivePlayer.POSSESS_ANIMATION_LENGTH) {
            for (EntityPossessHandler handler : PossessHandler.getPossessHandlers(possessivePlayer.getPossessing())) {
                handler.onClickAir(possessivePlayer, player);
            }
            Possessed.getNetworkWrapper().sendToServer(new PossessClickEmptyMessage());
        }
    }
}
 
开发者ID:Fararise,项目名称:Possessed,代码行数:14,代码来源:ClientEventHandler.java

示例4: onPlayerClick

import net.minecraftforge.event.entity.player.PlayerInteractEvent; //导入方法依赖的package包/类
@SubscribeEvent
    public void onPlayerClick(PlayerInteractEvent event) {
        if (event instanceof PlayerInteractEvent.RightClickEmpty) return;

        ItemStack heldItem = event.getEntityPlayer().getHeldItem(event.getHand());

        IBlockState interactedBlockState = event.getWorld().getBlockState(event.getPos());
        Block interactedBlock = interactedBlockState.getBlock();
        if (!event.getEntityPlayer().capabilities.isCreativeMode || !event.getEntityPlayer().canUseCommand(2, "securityStation")) {
            if (event.getWorld() != null && !event.getWorld().isRemote) {
                if (interactedBlock != Blockss.SECURITY_STATION || event instanceof PlayerInteractEvent.LeftClickBlock) {
                    boolean tryingToPlaceSecurityStation = heldItem.getItem() instanceof ItemBlock && ((ItemBlock) heldItem.getItem()).getBlock() == Blockss.SECURITY_STATION;
                    int blockingStations = PneumaticCraftUtils.getProtectingSecurityStations(event.getWorld(), event.getPos(), event.getEntityPlayer(), true, tryingToPlaceSecurityStation);
                    if (blockingStations > 0) {
                        event.setCanceled(true);
                        event.getEntityPlayer().sendStatusMessage(
                                new TextComponentTranslation(
                                        tryingToPlaceSecurityStation ? "message.securityStation.stationPlacementPrevented" : "message.securityStation.accessPrevented",
                                        blockingStations), false);
                    }
                }
            }
        }

        if (!event.isCanceled() && event instanceof PlayerInteractEvent.RightClickBlock && !event.getWorld().isRemote) {
            if (event.getEntityPlayer().isSneaking() && (interactedBlock == Blockss.ELEVATOR_CALLER || interactedBlock == Blockss.CHARGING_STATION)) {
                // work around the fact that Block#onBlockActivated doesn't get called server-side when sneaking
                event.setCanceled(interactedBlock.onBlockActivated(event.getWorld(), event.getPos(), interactedBlockState, event.getEntityPlayer(), event.getHand(), event.getFace(), 0, 0, 0));
            } else if (ModInteractionUtilImplementation.getInstance().isModdedWrench(heldItem)) {
                // when player clicks with a modded wrench, enforce our rotation behaviour and cancel default behaviour
                // (which is probably to call the "vanilla" rotateBlock(), which doesn't get any player information)
                if (interactedBlock instanceof IPneumaticWrenchable) {
                    ((IPneumaticWrenchable) interactedBlock).rotateBlock(event.getWorld(), event.getEntityPlayer(), event.getPos(), event.getFace());
                    event.setCanceled(true);
                }
            }
        }

//        if (!event.isCanceled() && interactedBlock == Blocks.COBBLESTONE) {
//            AdvancementUtils.checkFor9x9(event.getEntityPlayer(), event.getPos());
//        }
    }
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:43,代码来源:EventHandlerPneumaticCraft.java

示例5: onRightClickAir

import net.minecraftforge.event.entity.player.PlayerInteractEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onRightClickAir(PlayerInteractEvent.RightClickEmpty event) {
    EntityPlayer player = event.getEntityPlayer();
    ServerBlockSystemHandler structureHandler = BlockSystems.PROXY.getBlockSystemHandler(event.getWorld());
    structureHandler.interact(structureHandler.get(structureHandler.getMousedOver(player), player), player, event.getHand());
}
 
开发者ID:gegy1000,项目名称:BlockSystems,代码行数:7,代码来源:ClientEventHandler.java

示例6: renderPlayerRightClick

import net.minecraftforge.event.entity.player.PlayerInteractEvent; //导入方法依赖的package包/类
@SubscribeEvent(receiveCanceled = true)
public void renderPlayerRightClick(PlayerInteractEvent.RightClickEmpty event) {
    if (event.getItemStack().getItem() instanceof Item_Firearm) {
        //event.getEntityPlayer().swingProgressInt = 0;
    }
}
 
开发者ID:Hoijima,项目名称:Fallout_Equestria,代码行数:7,代码来源:EventPlayerRenders.java


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