本文整理汇总了Java中net.minecraft.client.gui.GuiMainMenu类的典型用法代码示例。如果您正苦于以下问题:Java GuiMainMenu类的具体用法?Java GuiMainMenu怎么用?Java GuiMainMenu使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuiMainMenu类属于net.minecraft.client.gui包,在下文中一共展示了GuiMainMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDraw
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
@SubscribeEvent
public void onDraw(GuiScreenEvent.DrawScreenEvent.Post event) {
if (event.gui instanceof GuiMainMenu
|| event.gui instanceof GuiIngameMenu) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
if (MoteCraft.mote == null) {
this.mc.renderEngine.bindTexture(new ResourceLocation(
MoteCraft.MODID, String.format("wiimote_search%02d.png",
this.animstate / 3)));
} else {
this.mc.renderEngine.bindTexture(new ResourceLocation(
MoteCraft.MODID, "wiimote_found.png"));
}
/*
* this.drawTexturedModalRect( 0, 0, 0, 0, 230, 1000);
*/
Utils.drawTexturedQuadFit(10, 10, 32, 32, zLevel + 1);
}
}
示例2: intercept
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
@Override
public Object intercept(Object obj, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
if (args == null || args.length > 1 || args.length == 0) {
return methodProxy.invokeSuper(obj, args);
}
if (method.getName().contains("guiRender") || method.getName().contains("mouseClick")) {
Object arg0 = args[0];
if (arg0 instanceof GuiScreenEvent) {
GuiScreenEvent drawEvent = (GuiScreenEvent) arg0;
if (drawEvent.getGui() instanceof GuiMainMenu) {
// Don't invoke.
return methodProxy.getSignature().getReturnType().getOpcode(VOID);
}
}
}
return methodProxy.invokeSuper(obj, args);
}
示例3: onDisconnect
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
/**
* Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
*/
public void onDisconnect(IChatComponent reason)
{
this.gameController.loadWorld((WorldClient)null);
if (this.guiScreenServer != null)
{
if (this.guiScreenServer instanceof GuiScreenRealmsProxy)
{
this.gameController.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy)this.guiScreenServer).func_154321_a(), "disconnect.lost", reason)).getProxy());
}
else
{
this.gameController.displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", reason));
}
}
else
{
this.gameController.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", reason));
}
}
示例4: initGui
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
@Override
public void initGui()
{
super.initGui();
// adjust position of options, quit & language buttons
for(GuiButton button : buttonList)
button.yPosition = Math.min(button.yPosition, height - 56);
// notice
noticeWidth1 = fontRendererObj.getStringWidth(noticeText);
noticeWidth2 =
fontRendererObj.getStringWidth(GuiMainMenu.MORE_INFO_TEXT);
int noticeWidth = Math.max(noticeWidth1, noticeWidth2);
noticeX1 = (width - noticeWidth) / 2;
noticeY1 = buttonList.get(0).yPosition - 24;
noticeX2 = noticeX1 + noticeWidth;
noticeY2 = noticeY1 + 24;
}
示例5: onDisconnect
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
/**
* Invoked when disconnecting, the parameter is a ChatComponent describing the
* reason for termination
*/
public void onDisconnect(IChatComponent reason) {
this.gameController.loadWorld((WorldClient) null);
if (this.guiScreenServer != null) {
if (this.guiScreenServer instanceof GuiScreenRealmsProxy) {
this.gameController.displayGuiScreen(
(new DisconnectedRealmsScreen(((GuiScreenRealmsProxy) this.guiScreenServer).func_154321_a(),
"disconnect.lost", reason)).getProxy());
} else {
this.gameController
.displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", reason));
}
} else {
this.gameController.displayGuiScreen(
new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", reason));
}
}
示例6: onRenderTick
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent ev)
{
purgeExpiredFragments(null);
if (Minecraft.getMinecraft().currentScreen != null && !(Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu))
return;
int displayWidth = Minecraft.getMinecraft().displayWidth;
int displayHeight = Minecraft.getMinecraft().displayHeight;
ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft(), displayWidth, displayHeight);
int width = res.getScaledWidth();
int height = res.getScaledHeight();
float rx = (float) width / 1000f;
float ry = (float) height / 1000f;
synchronized(this.fragments)
{
for (TextCategory cat : TextCategory.values())
{
TextCategoryAttributes atts = this.attributes.get(cat);
if (atts != null && (!atts.flashing || ((System.currentTimeMillis() / 500) % 3 != 0)) && shouldDisplay(atts.displayLevel))
{
int x = Math.round(rx * (float) atts.xOrg);
int y = Math.round(ry * (float) atts.yOrg);
ArrayList<TextFragment> frags = this.fragments.get(cat);
if (frags != null && !frags.isEmpty())
{
for (TextFragment frag : frags)
{
drawText(frag.text, x, y, atts.colour);
y += 10;
}
}
}
}
}
}
示例7: onDisconnect
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
/**
* Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
*/
public void onDisconnect(ITextComponent reason)
{
this.gameController.loadWorld((WorldClient)null);
if (this.guiScreenServer != null)
{
if (this.guiScreenServer instanceof GuiScreenRealmsProxy)
{
this.gameController.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy)this.guiScreenServer).getProxy(), "disconnect.lost", reason)).getProxy());
}
else
{
this.gameController.displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", reason));
}
}
else
{
this.gameController.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", reason));
}
}
示例8: load
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
@Override
public void load() {
accountManager = new AccountManager();
mainMenuHook = new AltManagerMainMenuHook();
helpTextInfo = new Listener<RenderEverything>() {
@Override
public void call(RenderEverything event) {
if (mc.currentScreen instanceof GuiMainMenu) {
mc.fontRendererObj.drawStringWithShadow("Serenity (Community Edition) b" + BUILD_NUMBER, 2, 2, 0x07A4FE);
mc.fontRendererObj.drawStringWithShadow("Press both shifts to show the account manager.", 2, 12, 0xFFFFFF);
}
}
};
EventManager.register(mainMenuHook);
EventManager.register(helpTextInfo);
}
示例9: connectToServerAtStartup
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
public void connectToServerAtStartup(String host, int port)
{
setupServerList();
ServerPinger osp = new ServerPinger();
ServerData serverData = new ServerData("Command Line", host+":"+port,false);
try
{
osp.ping(serverData);
startupConnectionData.await(30, TimeUnit.SECONDS);
}
catch (Exception e)
{
showGuiScreen(new GuiConnecting(new GuiMainMenu(), client, host, port));
return;
}
connectToServer(new GuiMainMenu(), serverData);
}
示例10: onOpenGui
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
@SubscribeEvent
public void onOpenGui(GuiOpenEvent event) {
if (event.gui instanceof GuiMainMenu) {
event.gui = new RewiMainMenu();
}
if (event.gui instanceof GuiIngameMenu) {
event.gui = new RewiIngameMenu();
}
if (event.gui instanceof GuiOptions) {
event.gui = new RewiOptionsMenu(Minecraft.getMinecraft().currentScreen, Minecraft.getMinecraft().gameSettings);
}
}
示例11: onGuiOpen
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onGuiOpen(GuiOpenEvent event)
{
if(event.getGui() instanceof GuiMainMenu && !played)
{
played = true;
if(playOn == 1 || playOn == 3)
{
SoundEvent sound = SoundEvent.REGISTRY.getObject(new ResourceLocation(name));
if(sound != null)
{
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(sound, (float)pitch));
}
else
{
logger.log(Level.WARN, "Could not find sound: %s", new ResourceLocation(name));
}
}
}
}
示例12: connectToServerAtStartup
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
public void connectToServerAtStartup(String host, int port)
{
setupServerList();
OldServerPinger osp = new OldServerPinger();
ServerData serverData = new ServerData("Command Line", host+":"+port);
try
{
osp.func_147224_a(serverData);
startupConnectionData.await(30, TimeUnit.SECONDS);
}
catch (Exception e)
{
showGuiScreen(new GuiConnecting(new GuiMainMenu(), client, host, port));
return;
}
connectToServer(new GuiMainMenu(), serverData);
}
示例13: onInitGuiScreen
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
@SubscribeEvent
public void onInitGuiScreen(GuiScreenEvent.InitGuiEvent.Post event) {
if (active) {
LabelButtonInfo.inject(event.getGui());
if (event.getGui() instanceof GuiIngameMenu) {
event.getButtonList().add(new GuiButton(200, (event.getGui().width / 2) - 100, event.getGui().height - 20, I18n.format("gui.controller")));
}
if (event.getGui() instanceof GuiMainMenu) {
this.selector = new GuiButtonSelector(event.getGui().width / 2, event.getGui().height / 2 + 30, 40, event.getButtonList().toArray(new GuiButton[0]));
event.getButtonList().clear();
}
if (event.getButtonList().size() != 0)
ActionButtonChange.moveMouse(new Wrapper(event.getButtonList().get(0)), event.getGui().width, event.getGui().height);
}
}
示例14: onGuiOpen
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
@SubscribeEvent
public static void onGuiOpen(@Nonnull final GuiOpenEvent event) {
if (!hasPlayed && event.getGui() instanceof GuiMainMenu) {
hasPlayed = true;
final String[] possibles = ModOptions.startupSoundList;
if (possibles == null || possibles.length == 0)
return;
final String res = possibles[XorShiftRandom.current().nextInt(possibles.length)];
if (!StringUtils.isEmpty(res)) {
final SoundEvent se = SoundEvent.REGISTRY.getObject(new ResourceLocation(res));
if (se != null)
SoundEngine.instance().playSound(new AdhocSound(se, SoundCategory.MASTER));
else
DSurround.log().warn("Unable to locate startup sound [%s]", res);
} else {
DSurround.log().warn("Improperly formatted startup sound list!");
}
}
}
示例15: startUpdateThread
import net.minecraft.client.gui.GuiMainMenu; //导入依赖的package包/类
protected void startUpdateThread() {
new Thread("Info Frame Update Thread") {
public void run() {
while (true) {
if (Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu) {
dispose();
}
if (instance == null || !isVisible()) {
return;
}
update();
if (dialog != null) {
dialog.update();
}
try {
Thread.sleep(50);
} catch (InterruptedException ignored) {
}
}
}
}.start();
}