本文整理汇总了Java中net.minecraft.client.gui.GuiDisconnected类的典型用法代码示例。如果您正苦于以下问题:Java GuiDisconnected类的具体用法?Java GuiDisconnected怎么用?Java GuiDisconnected使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuiDisconnected类属于net.minecraft.client.gui包,在下文中一共展示了GuiDisconnected类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onGuiOpened
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
@SubscribeEvent
public void onGuiOpened(GuiOpenEvent event) {
if (!hasAutoLogged)
if(event.getGui() instanceof GuiDisconnected &&
!(event.getGui() instanceof GuiDisconnectedOverride)) {
updateLastConnectedServer();
GuiDisconnected disconnected = (GuiDisconnected)event.getGui();
event.setGui(new GuiDisconnectedOverride(
FastReflection.Fields.GuiDisconnected_parentScreen.get(disconnected),
"connect.failed",
FastReflection.Fields.GuiDisconnected_message.get(disconnected),
FastReflection.Fields.GuiDisconnected_reason.get(disconnected),
delay.get()
));
}
}
示例2: onDisconnect
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的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));
}
}
示例3: onDisconnect
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的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: onDisconnect
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的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));
}
}
示例5: instanceOf
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
public boolean instanceOf(CommonScreenTypes type) {
if (type.equals(CommonScreenTypes.GuiDisconnected)) {
return screen instanceof GuiDisconnected;
} else if (type.equals(CommonScreenTypes.GuiIngameMenu)) {
return screen instanceof GuiIngameMenu;
}
return false;
}
示例6: onClientTick
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onClientTick(TickEvent.ClientTickEvent event) {
Minecraft mc = Minecraft.getMinecraft();
if (event.phase == TickEvent.Phase.END && mc.theWorld != null && !mc.isSingleplayer()) {
UUID uuid = mc.thePlayer.getUniqueID();
timeOnCount.add(uuid);
if ((maxTimeOn.containsKey(uuid) && timeOnCount.count(uuid) > maxTimeOn.get(uuid)) || (maxTimeOnGlobal != 0 && timeOnCount.count(uuid) > maxTimeOnGlobal)) {
rejoinTime.put(uuid, System.currentTimeMillis() + (breakTime.containsKey(uuid) ? breakTime.get(uuid) * 50 : breakTimeGlobal * 50));
timeOnCount.remove(uuid, timeOnCount.count(uuid));
}
//Disconnect if still on timeout
if (rejoinTime.containsKey(uuid) && System.currentTimeMillis() < rejoinTime.get(uuid)) {
mc.theWorld.sendQuittingDisconnectingPacket();
mc.loadWorld(null);
mc.displayGuiScreen(new GuiDisconnected(null, String.format(kickMessage + " You can rejoin in approx. %s minute(s)",
(int) Math.floor(((rejoinTime.get(uuid) - System.currentTimeMillis()) / 1000F) / 60F)), new TextComponentString("")));
}
}
}
示例7: onTick
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
@SubscribeEvent
public void onTick(ClientTickEvent event) {
if(mc.currentScreen instanceof GuiDisconnected) {
GuiDisconnected current = (GuiDisconnected) mc.currentScreen;
current.drawCenteredString(mc.fontRendererObj, time + " seconds", current.width / 2, 30, Color.WHITE.getRGB());
if(System.currentTimeMillis() - last >= 1000l) {
time--;
last = System.currentTimeMillis();
}
if(time == 0) {
connectToServer();
}
}
if(mc.getCurrentServerData() != null) {
data = mc.getCurrentServerData();
}
}
示例8: onDisconnect
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
public void onDisconnect(IChatComponent p_147231_1_)
{
this.gameController.loadWorld((WorldClient)null);
if (this.guiScreenServer != null)
{
if (this.guiScreenServer instanceof GuiScreenRealmsProxy)
{
this.gameController.displayGuiScreen((new DisconnectedOnlineScreen(((GuiScreenRealmsProxy)this.guiScreenServer).func_154321_a(), "disconnect.lost", p_147231_1_)).getProxy());
}
else
{
this.gameController.displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", p_147231_1_));
}
}
else
{
this.gameController.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", p_147231_1_));
}
}
示例9: handleErrorMessage
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
public void handleErrorMessage(String par1Str, Object[] par2ArrayOfObj)
{
if (!this.disconnected)
{
this.disconnected = true;
this.mc.loadWorld((WorldClient)null);
if (this.field_98183_l != null)
{
this.mc.displayGuiScreen(new GuiScreenDisconnectedOnline(this.field_98183_l, "disconnect.lost", par1Str, par2ArrayOfObj));
}
else
{
this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", par1Str, par2ArrayOfObj));
}
}
}
示例10: GuiDisconnectedOverride
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
public GuiDisconnectedOverride(GuiScreen screen, String reasonLocalizationKey, ITextComponent chatComp, String reason, double delay) {
super(screen, reasonLocalizationKey, chatComp);
parent = screen;
message = chatComp;
reconnectTime = System.currentTimeMillis() + (long)(delay * 1000);
// set variable 'reason' to the previous classes value
try {
ReflectionHelper.setPrivateValue(GuiDisconnected.class, this, reason, "reason", "field_146306_a", "a"); // TODO: Find obbed mapping name
} catch (Exception e) {
Helper.printStackTrace(e);
}
// parse server return text and find queue pos
}
示例11: draw
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
@CoreEvent
public void draw(final DrawScreenEvent.Post e) {
final GuiScreen gui = this.mc.currentScreen;
if (gui instanceof GuiMultiplayer) {
} else if (gui instanceof GuiDisconnected) {
if (this.disableBackButton!=null&&Config.getConfig().durationDisconnected.get()>=10)
this.disableBackButton.displayString = I18n.format("serverobserver.gui.backandstop.time", I18n.format("serverobserver.gui.backandstop"), timeremain());
} else if (gui instanceof GuiMainMenu) {
final GuiButton button = this.mainMenuButtonMulti;
if (button!=null&&this.target.getIP()!=null&&!this.manualOpen)
button.displayString = I18n.format("serverobserver.gui.maintomulti.time", I18n.format("menu.multiplayer"), timeremain());
}
}
示例12: action
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
@CoreEvent
public void action(final ActionPerformedEvent.Post e) {
this.targetServerStatus = null;
final GuiScreen screen = this.mc.currentScreen;
final int id = this.compat.getButton(e).id;
if (screen instanceof GuiMultiplayer&&id==BUTTON_ID) {
final GuiMultiplayer mpgui = (GuiMultiplayer) screen;
final ServerData server = getServerData(mpgui, this.compat.getSelected(mpgui));
if (server!=null) {
if (!StringUtils.equals(this.target.getIP(), server.serverIP)) {
this.autologin.set(false);
this.target.set(server);
} else if (!this.autologin.is()) {
this.autologin.set(true);
this.target.set(server);
} else {
this.autologin.set(false);
this.target.set(null);
}
} else
selectTarget(mpgui, this.target.getIP());
} else if (screen instanceof GuiDisconnected&&id==DISABLE_BACK_BUTTON_ID) {
final GuiDisconnected dcgui = (GuiDisconnected) screen;
this.autologin.set(false);
this.target.set(null);
this.mc.displayGuiScreen(this.compat.getParentScreen(dcgui));
}
this.displayTime = "";
reset(Config.getConfig().durationPing);
this.manual = false;
}
示例13: onDisconnect
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
/**
* Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
*/
public void onDisconnect(ITextComponent reason)
{
if (this.previousGuiScreen != null && this.previousGuiScreen instanceof GuiScreenRealmsProxy)
{
this.mc.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy)this.previousGuiScreen).getProxy(), "connect.failed", reason)).getProxy());
}
else
{
this.mc.displayGuiScreen(new GuiDisconnected(this.previousGuiScreen, "connect.failed", reason));
}
}
示例14: onGuiOpen
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
if(event.getGui() instanceof GuiDisconnected) {
last = System.currentTimeMillis();
time = 10;
}
}
示例15: onDisconnect
import net.minecraft.client.gui.GuiDisconnected; //导入依赖的package包/类
/**
* Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination
*/
public void onDisconnect(IChatComponent p_147231_1_)
{
this.gameController.loadWorld((WorldClient)null);
if (this.guiScreenServer != null)
{
this.gameController.displayGuiScreen(new GuiScreenDisconnectedOnline(this.guiScreenServer, "disconnect.lost", p_147231_1_));
}
else
{
this.gameController.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new HookGuiMainMenu()), "disconnect.lost", p_147231_1_));
}
}