本文整理汇总了Java中net.minecraft.client.gui.GuiChat类的典型用法代码示例。如果您正苦于以下问题:Java GuiChat类的具体用法?Java GuiChat怎么用?Java GuiChat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuiChat类属于net.minecraft.client.gui包,在下文中一共展示了GuiChat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldAllowWalking
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
public boolean shouldAllowWalking() {
// check if mod is active
if (!isActive()) return false;
// check if there is a player to move
Minecraft mc = Minecraft.getMinecraft();
if (mc.thePlayer == null) return false;
// check if player is viewing chat
if ((mc.currentScreen instanceof GuiChat) || (mc.currentScreen instanceof GuiIngameMenu) ||
(mc.currentScreen instanceof NavigatorScreen)) {
return false;
}
// check if inventory key is pressed
return !Keyboard.isKeyDown(mc.gameSettings.keyBindInventory.getKeyCode());
}
示例2: shouldDisplayTankGui
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static boolean shouldDisplayTankGui(GuiScreen gui)
{
if (FMLClientHandler.instance().getClient().gameSettings.hideGUI)
{
return false;
}
if (gui == null)
{
return true;
}
if (gui instanceof GuiInventory)
{
return false;
}
return gui instanceof GuiChat;
}
示例3: onKeyInput
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
// first check that the player is not using the chat menu
// you can use this method from before:
// if (FMLClientHandler.instance().getClient().inGameHasFocus) {
// or you can use this new one that is available, doesn't really matter
if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) {
// you can get the key code of the key pressed using the Keyboard class:
int kb = Keyboard.getEventKey();
// similarly, you can get the key state, but this will always be true when the event is fired:
boolean isDown = Keyboard.getEventKeyState();
// same as before, chain if-else if statements to find which of your custom keys
// was pressed and act accordingly:
if (kb == keys[CUSTOM_INV].getKeyCode()) {
EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
// before you could close the screen from here, but that no longer seems to be
// possible instead, you need to do so from within the GUI itself
// so we will just send a packet to open the GUI:
player.openGui(LOTRRings.instance, UIHandler.PLAYERINVENTORY_UI_1, player.getEntityWorld(), player.chunkCoordX, player.chunkCoordY, player.chunkCoordZ);
}
}
}
示例4: canDisplayInfoBar
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
public boolean canDisplayInfoBar(Minecraft mc, ClientProxy clientProxy) {
if(!clientProxy.isBuildMode())
return false;
if(mc.currentScreen == null)
return true;
if(mc.currentScreen instanceof GuiIngameMenu)
return true;
if(mc.currentScreen instanceof GuiChat)
return true;
return false;
}
示例5: onKeyInput
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
@SubscribeEvent
public void onKeyInput( KeyInputEvent event )
{
if( (!FMLClientHandler.instance().isGUIOpen( GuiChat.class )) && (mc.currentScreen == null) && (mc.world != null) )
{
if( XRay.keyBind_keys[ XRay.keyIndex_toggleXray ].isPressed() )
{
XRay.drawOres = !XRay.drawOres;
XrayRenderer.ores.clear();
}
else if( XRay.keyBind_keys[ XRay.keyIndex_showXrayMenu ].isPressed() )
{
mc.displayGuiScreen( new GuiList() );
}
}
}
示例6: onMouseInput
import net.minecraft.client.gui.GuiChat; //导入依赖的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));
}
}
示例7: onTick
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
public static void onTick(TickEvent event) {
if (System.currentTimeMillis() % 10 == 0) {
Main.start("mcpvp", "vars");
AllVars.putVars();
Main.end(2);
}
if (event.type == TickEvent.Type.RENDER && event.phase == event.phase.END) {
if (Main.mc.currentScreen == null || Main.mc.currentScreen instanceof GuiChat) {
Main.start("mcpvp", "alerts");
Alerts.alert.showAlerts();
Medal.showAll();
Main.end(2);
}
}
for (BoardTracker tracker : BoardTracker.boardTrackers) {
Main.start("mcpvp", "trackers");
tracker.update();
Main.end(2);
}
}
示例8: textRenderEvent
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void textRenderEvent(RenderGameOverlayEvent.Text event)
{
if (keyBinding == null) return;
if (Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu)
{
event.getLeft().add(NAME + " paused. Main menu open. If you want to AFK, use ALT+TAB.");
}
else if (Minecraft.getMinecraft().currentScreen instanceof GuiChat)
{
event.getLeft().add(NAME + " paused. Chat GUI open. If you want to AFK, use ALT+TAB.");
}
else
{
event.getLeft().add(NAME + " active: " + keyBinding.getDisplayName() + " (" + keyBinding.getKeyDescription().replaceFirst("^key\\.", "") + ')');
event.getLeft().add("Delay: " + i + " / " + delay);
}
}
示例9: onOpenGui
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onOpenGui(GuiOpenEvent event) {
Minecraft mc = Minecraft.getMinecraft();
if (mc.player != null && mc.player.getHealth() <= 0f) {
mc.player.setSneaking(false);
if (event.getGui() instanceof GuiChat && mc.gameSettings.keyBindSneak.isKeyDown()) {
event.setGui(new GuiChat("/team "));
}
}
}
示例10: onInitGui
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
@SubscribeEvent
public void onInitGui(GuiScreenEvent.InitGuiEvent.Post event) {
GuiScreen gui = event.getGui();
if(isEnabled && gui.mc.player != null && gui.mc.player.getHealth() <= 0f && gui instanceof GuiChat) {
buttonPing = new GuiButton(-999, gui.width / 2 - 100, gui.height / 2 + 30, I18n.format("gui.hardcorerevival.send_ping"));
event.getButtonList().add(buttonPing);
}
}
示例11: onInitGui
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
@SubscribeEvent
public void onInitGui(GuiScreenEvent.InitGuiEvent.Post event) {
Minecraft mc = event.getGui().mc;
if (mc.player != null && isKnockedOut && event.getGui() instanceof GuiChat) {
GuiScreen gui = event.getGui();
enableButtonTimer = 0;
buttonDie = new GuiButton(-2, gui.width / 2 - 100, gui.height / 2 - 30, I18n.format("gui.hardcorerevival.die"));
buttonDie.enabled = false;
event.getButtonList().add(buttonDie);
}
}
示例12: onDrawScreen
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
@SubscribeEvent
public void onDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) {
GuiScreen gui = event.getGui();
Minecraft mc = gui.mc;
if (mc.player != null && isKnockedOut && gui instanceof GuiChat) {
enableButtonTimer += event.getRenderPartialTicks();
if(buttonDie != null) {
if (enableButtonTimer >= 40) {
buttonDie.enabled = true;
buttonDie.displayString = I18n.format("gui.hardcorerevival.die");
} else if (enableButtonTimer >= 30) {
buttonDie.displayString = "... " + I18n.format("gui.hardcorerevival.die") + " ...";
} else if (enableButtonTimer >= 20) {
buttonDie.displayString = ".. " + I18n.format("gui.hardcorerevival.die") + " ..";
} else if (enableButtonTimer >= 10) {
buttonDie.displayString = ". " + I18n.format("gui.hardcorerevival.die") + " .";
}
}
GlStateManager.pushMatrix();
GlStateManager.scale(2f, 2f, 2f);
gui.drawCenteredString(mc.fontRenderer, I18n.format("gui.hardcorerevival.knocked_out"), gui.width / 2 / 2, 30, 16777215);
GlStateManager.popMatrix();
gui.drawCenteredString(mc.fontRenderer, I18n.format("gui.hardcorerevival.rescue_time_left", Math.max(0, (ModConfig.maxDeathTicks - deathTime) / 20)), gui.width / 2, gui.height / 2 + 10, 16777215);
} else if(buttonDie != null) {
buttonDie.visible = false;
}
}
示例13: handleTabComplete
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
/**
* Displays the available command-completion options the server knows of
*/
public void handleTabComplete(S3APacketTabComplete packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
String[] astring = packetIn.func_149630_c();
if (this.gameController.currentScreen instanceof GuiChat)
{
GuiChat guichat = (GuiChat)this.gameController.currentScreen;
guichat.onAutocompleteResponse(astring);
}
}
示例14: handleTabComplete
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
/**
* Displays the available command-completion options the server knows of
*/
public void handleTabComplete(S3APacketTabComplete packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
String[] astring = packetIn.func_149630_c();
if (this.gameController.currentScreen instanceof GuiChat) {
GuiChat guichat = (GuiChat) this.gameController.currentScreen;
guichat.onAutocompleteResponse(astring);
}
}
示例15: isChatOpen
import net.minecraft.client.gui.GuiChat; //导入依赖的package包/类
public static boolean isChatOpen() {
if (Minecraft.getMinecraft().currentScreen != null) {
if (Minecraft.getMinecraft().currentScreen instanceof GuiChat) {
return true;
}
}
return false;
}