本文整理汇总了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);
}
}
}
示例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);
}
}
}
}
示例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());
}
}
}
示例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());
// }
}
示例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());
}
示例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;
}
}