本文整理匯總了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;
}
}