當前位置: 首頁>>代碼示例>>Java>>正文


Java InputEvent.MouseInputEvent方法代碼示例

本文整理匯總了Java中cpw.mods.fml.common.gameevent.InputEvent.MouseInputEvent方法的典型用法代碼示例。如果您正苦於以下問題:Java InputEvent.MouseInputEvent方法的具體用法?Java InputEvent.MouseInputEvent怎麽用?Java InputEvent.MouseInputEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cpw.mods.fml.common.gameevent.InputEvent的用法示例。


在下文中一共展示了InputEvent.MouseInputEvent方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onMouseInput

import cpw.mods.fml.common.gameevent.InputEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
	if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) {
		Minecraft mc = Minecraft.getMinecraft();
		EntityPlayer thePlayer = mc.getMinecraft().thePlayer;
		ItemStack hand = thePlayer.getCurrentEquippedItem();
		ExtendedPlayer props = ExtendedPlayer.get((EntityPlayer) thePlayer);
		int x = mc.objectMouseOver.blockX;
		int y = mc.objectMouseOver.blockY;
		int z = mc.objectMouseOver.blockZ;
		if (Mouse.isButtonDown(1) && hand == null)
			props.useMana(10);
		// TheDarkEra.packetPipeline.sendToServer(new PacketUseShout(x, y,
		// z));
	}
}
 
開發者ID:TheDarkEra,項目名稱:TheDarkEra,代碼行數:17,代碼來源:KeyHandler.java

示例2: onMouseInput

import cpw.mods.fml.common.gameevent.InputEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
	if (Config.keyOverlay) {
		if (Mouse.getEventButtonState())
			try {
				KeyOverlay.keys.offer(new Object[]{Mouse.getButtonName(Mouse.getEventButton()).toUpperCase(), KeyOverlay.KEY_LIFE_LENGTH});
			} catch (Exception e) {
				e.printStackTrace();
			}
	}
}
 
開發者ID:austinv11,項目名稱:CollectiveFramework,代碼行數:12,代碼來源:KeyHandler.java

示例3: onMouseInput

import cpw.mods.fml.common.gameevent.InputEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
	if (Config.showKeysOnHUD) {
		if (Mouse.getEventButtonState())
			try {
				KeyOverlay.keys.offer(new Object[]{Mouse.getButtonName(Mouse.getEventButton()).toUpperCase(), KeyOverlay.KEY_LIFE_LENGTH});
			} catch (Exception e) {
				e.printStackTrace();
			}
	}
}
 
開發者ID:austinv11,項目名稱:MacroMaker,代碼行數:12,代碼來源:KeyHandler.java

示例4: mouseInputEvent

import cpw.mods.fml.common.gameevent.InputEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void mouseInputEvent(InputEvent.MouseInputEvent event) {
	if(!Configuration.lockUI && !Mouse.isGrabbed()) {

		if(Mouse.isButtonDown(2)) {
			ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
			int i = scaledresolution.getScaledWidth();
			int j = scaledresolution.getScaledHeight();
			int mouseX =  Mouse.getX() * i / Minecraft.getMinecraft().displayWidth;
			int mouseY = j - Mouse.getY() * j / Minecraft.getMinecraft().displayHeight - 1;

			if(currentlySelectedBox == null && mouseX >= suitPanel.getX(i) && mouseX < suitPanel.getX(i) + suitPanel.sizeX &&
					mouseY >= suitPanel.getY(j) && mouseY < suitPanel.getY(j) + suitPanel.sizeY) {
				currentlySelectedBox = suitPanel;
			}
			
			if(currentlySelectedBox == null && mouseX >= oxygenBar.getX(i) && mouseX < oxygenBar.getX(i) + oxygenBar.sizeX &&
					mouseY >= oxygenBar.getY(j) && mouseY < oxygenBar.getY(j) + oxygenBar.sizeY) {
				currentlySelectedBox = oxygenBar;
			}

			if(currentlySelectedBox == null && mouseX >= hydrogenBar.getX(i) && mouseX < hydrogenBar.getX(i) + hydrogenBar.sizeX &&
					mouseY >= hydrogenBar.getY(j) && mouseY < hydrogenBar.getY(j) + hydrogenBar.sizeY) {
				currentlySelectedBox = hydrogenBar;
			}
			
			if(currentlySelectedBox == null && mouseX >= atmBar.getX(i) && mouseX < atmBar.getX(i) + atmBar.sizeX &&
					mouseY >= atmBar.getY(j) && mouseY < atmBar.getY(j) + atmBar.sizeY) {
				currentlySelectedBox = atmBar;
			}
			
			if(currentlySelectedBox != null) {

				currentlySelectedBox.setRenderX(mouseX, i);
				currentlySelectedBox.setRenderY(mouseY, j);
			}
		}
		else
			currentlySelectedBox = null;
	}
}
 
開發者ID:zmaster587,項目名稱:AdvancedRocketry,代碼行數:42,代碼來源:RocketEventHandler.java

示例5: onClick

import cpw.mods.fml.common.gameevent.InputEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onClick(InputEvent.MouseInputEvent event) {
	if (checkSmartHelmetStatus()) {
		PeripheralsPlusPlus.NETWORK.sendToServer(new InputEventPacket(UUID.fromString(Minecraft.getMinecraft().thePlayer.getCurrentArmor(3).getTagCompound().getString("identifier")), Mouse.getEventButton(), Mouse.getEventButtonState(), "mouseInput", Minecraft.getMinecraft().thePlayer.getDisplayName()));
	}
}
 
開發者ID:austinv11,項目名稱:PeripheralsPlusPlus,代碼行數:7,代碼來源:SmartHelmetHandler.java


注:本文中的cpw.mods.fml.common.gameevent.InputEvent.MouseInputEvent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。