本文整理匯總了Java中net.minecraftforge.client.event.MouseEvent.isButtonstate方法的典型用法代碼示例。如果您正苦於以下問題:Java MouseEvent.isButtonstate方法的具體用法?Java MouseEvent.isButtonstate怎麽用?Java MouseEvent.isButtonstate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.client.event.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.isButtonstate方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onMouseClick
import net.minecraftforge.client.event.MouseEvent; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onMouseClick(MouseEvent event) {
Minecraft minecraft = Minecraft.getMinecraft();
EntityPlayer player = minecraft.player;
if (minecraft.gameSettings.thirdPersonView != 0
|| player.getHeldItem(EnumHand.MAIN_HAND).func_190916_E() <= 0
|| player.getHeldItem(EnumHand.MAIN_HAND).getItem() != InfernumItems.KNOWLEDGE_BOOK) {
return;
}
if (!player.getHeldItem(EnumHand.OFF_HAND).equals(ItemStack.field_190927_a)) {
return;
}
if (ticksOpen < 10 || pageFlipTicks > 0) {
return;
}
if (event.getButton() == 0 && event.isButtonstate()) {
event.setCanceled(true);
if (page > 0 && pageFlipTicks <= 0 && ticksOpen >= 10) {
page--;
pageFlipTicks = 10;
flipPageAngle = -coverAngles;
}
}
if (event.getButton() == 1 && event.isButtonstate()) {
event.setCanceled(true);
if (page < totalPages - 1 && pageFlipTicks <= 0 && ticksOpen >= 10) {
page++;
pageFlipTicks = 10;
flipPageAngle = coverAngles;
}
}
}
示例2: OnMouseWheelScroll
import net.minecraftforge.client.event.MouseEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void OnMouseWheelScroll (MouseEvent event) {
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.player;
World world = mc.world;
if (!mc.inGameHasFocus && !KeyboardHelper.isScrollActivatorDown()) {
event.setCanceled(false);
return;
}
/*if (player.getCapability(ModCapabilities.DRIVE_STATE, null).getInDrive()) {
if (player.getCapability(ModCapabilities.DRIVE_STATE, null).getActiveDriveName().equals(Strings.Form_Wisdom)) {
event.setCanceled(true);
} else {
event.setCanceled(false);
}
}*/
if (event.getButton() == Constants.LEFT_MOUSE && KeyboardHelper.isScrollActivatorDown() && event.isButtonstate()) {
commandEnter();
event.setCanceled(true);
}
if (event.getButton() == Constants.RIGHT_MOUSE && KeyboardHelper.isScrollActivatorDown() && event.isButtonstate()) {
commandBack();
event.setCanceled(true);
}
if (event.getDwheel() <= Constants.WHEEL_DOWN && KeyboardHelper.isScrollActivatorDown() && event.getDwheel() != 0) {
commandDown();
event.setCanceled(true);
world.playSound(player, player.getPosition(), ModSounds.move, SoundCategory.MASTER, 1.0f, 1.0f);
}
if (event.getDwheel() >= Constants.WHEEL_UP && KeyboardHelper.isScrollActivatorDown() && event.getDwheel() != 0) {
commandUp();
event.setCanceled(true);
world.playSound(player, player.getPosition(), ModSounds.move, SoundCategory.MASTER, 1.0f, 1.0f);
}
}
示例3: mouseClick
import net.minecraftforge.client.event.MouseEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void mouseClick(MouseEvent mouseEvent){
if (mouseEvent.isButtonstate()) {
if(doKey(mouseEvent.getButton() - 100)){
mouseEvent.setCanceled(true);
}
}
}
示例4: onEvent
import net.minecraftforge.client.event.MouseEvent; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(MouseEvent event)
{
if (event.getButton() == 0 && event.isButtonstate())
{
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer thePlayer = mc.thePlayer;
if (thePlayer != null)
{
ItemStack itemstack = thePlayer.getHeldItemMainhand();
IExtendedReach ieri;
if (itemstack != null)
{
if (itemstack.getItem() instanceof IExtendedReach)
{
ieri = (IExtendedReach) itemstack.getItem();
} else
{
ieri = null;
}
if (ieri != null)
{
float reach = ieri.getReach();
RayTraceResult mov = getMouseOverExtended(reach);
if (mov != null)
{
if (mov.entityHit != null && mov.entityHit.hurtResistantTime == 0)
{
if (mov.entityHit != thePlayer )
{
Polearms.network.sendToServer(new MessageExtendedReachAttack(
mov.entityHit.getEntityId()));
}
}
}
}
}
}
}
}
示例5: onEvent
import net.minecraftforge.client.event.MouseEvent; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onEvent(MouseEvent event) {
if (event.getButton() != 1) {
return;
}
if (!event.isButtonstate()) {
return;
}
EntityPlayer player = Minecraft.getMinecraft().player;
if (player == null) {
return;
}
ItemStack stack = player.getHeldItemMainhand();
if (stack == null || !(stack.getItem() instanceof IExtendedReach)) {
return;
}
IExtendedReach extendedReachItem = (IExtendedReach) stack.getItem();
RayTraceResult raytrace = getMouseOverExtended(extendedReachItem.getReach());
if (raytrace == null) {
return;
}
if (raytrace.entityHit != null) {
ToroChess.NETWORK.sendToServer(new MessageExtendedReachInteract(raytrace.entityHit.getEntityId()));
/*
* send to client
*/
((IExtendedReach) (stack.getItem())).itemInteractionForEntityExtended(stack, player, (EntityLivingBase) raytrace.entityHit,
EnumHand.MAIN_HAND);
} else if (RayTraceResult.Type.BLOCK.equals(raytrace.typeOfHit)) {
ToroChess.NETWORK.sendToServer(new MessageExtendedReachInteract(raytrace.getBlockPos()));
/*
* send to client
*/
Vec3d vec = player.getPositionVector();
((IExtendedReach) (stack.getItem())).onItemUseExtended(player, player.world, raytrace.getBlockPos(), EnumHand.MAIN_HAND, null,
(float) vec.x, (float) vec.y, (float) vec.z);
}
}
示例6: onMouseEvent
import net.minecraftforge.client.event.MouseEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onMouseEvent(MouseEvent evt)
{
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer thePlayer = mc.player;
ItemStack rightHandStack = thePlayer.getHeldItemMainhand();
ItemStack leftHandStack = thePlayer.getHeldItemMainhand();
InventoryAttachment att = InventoryAttachment.create(rightHandStack);
if(rightHandStack != null && rightHandStack.getItem() instanceof ItemRangedWeapon && leftHandStack != null && leftHandStack.getItem() instanceof ItemRangedWeapon)
{
ItemRangedWeapon rightHandGun = (ItemRangedWeapon) rightHandStack.getItem();
ItemRangedWeapon leftHandGun = (ItemRangedWeapon) leftHandStack.getItem();
if(!rightHandGun.IsTwoHanded() && !leftHandGun.IsTwoHanded())
{
System.out.println("duel Wielding");
}
else
{
//Fire the main hand gun
}
}
else if (rightHandStack != null && rightHandStack.getItem() instanceof ItemRangedWeapon)
{
if(leftHandStack != null && leftHandStack.getItem() instanceof ItemRangedWeapon)
System.out.println(leftHandStack.getItem());
if(evt.getButton() == 0)
{
evt.setCanceled(true);
}
if(evt.getButton() == 1)
{
// if()
evt.setCanceled(true);
if (att != null && att.isScopePresent()) {
showScopeOverlap = evt.isButtonstate();
selected = rightHandStack;
// if (showScopeOverlap)
}
}
}
}