當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。