Aether menu added back!
This commit is contained in:
parent
a64713a029
commit
d9a829366a
|
@ -14,9 +14,11 @@ import net.minecraftforge.fml.client.FMLClientHandler;
|
|||
|
||||
import com.legacy.aether.client.audio.AetherMusicHandler;
|
||||
import com.legacy.aether.client.gui.GuiAetherInGame;
|
||||
import com.legacy.aether.client.gui.menu.AetherMenuHandler;
|
||||
import com.legacy.aether.client.renders.AetherEntityRenderingRegistry;
|
||||
import com.legacy.aether.client.renders.blocks.BlockRendering;
|
||||
import com.legacy.aether.client.renders.items.ItemRendering;
|
||||
import com.legacy.aether.server.AetherConfig;
|
||||
import com.legacy.aether.server.ServerProxy;
|
||||
|
||||
public class ClientProxy extends ServerProxy
|
||||
|
@ -41,6 +43,11 @@ public class ClientProxy extends ServerProxy
|
|||
MinecraftForge.EVENT_BUS.register(new GuiAetherInGame(Minecraft.getMinecraft()));
|
||||
MinecraftForge.EVENT_BUS.register(new AetherClientEvents());
|
||||
|
||||
if (!AetherConfig.shouldUseAetherMenu())
|
||||
{
|
||||
registerEvent(new AetherMenuHandler());
|
||||
}
|
||||
|
||||
registerEvent(new AetherMusicHandler());
|
||||
registerEvent(new ClientTickHandler());
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
|
|||
|
||||
import com.legacy.aether.client.audio.music.AetherMusicTicker;
|
||||
import com.legacy.aether.client.gui.AetherLoadingScreen;
|
||||
import com.legacy.aether.server.AetherConfig;
|
||||
|
||||
public class ClientTickHandler
|
||||
{
|
||||
|
@ -30,7 +29,7 @@ public class ClientTickHandler
|
|||
mc.loadingScreen = new AetherLoadingScreen(mc);
|
||||
}
|
||||
|
||||
if (!mc.isGamePaused() && mc.thePlayer != null && mc.thePlayer.dimension == AetherConfig.getAetherDimensionID())
|
||||
if (!mc.isGamePaused() && mc.thePlayer != null)
|
||||
{
|
||||
musicTicker.update();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.legacy.aether.client.gui.menu.GuiAetherMainMenu;
|
||||
import com.legacy.aether.server.AetherConfig;
|
||||
import com.legacy.aether.server.registry.sounds.SoundsAether;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -30,20 +32,28 @@ public class AetherMusicTicker implements ITickable
|
|||
{
|
||||
TrackType tracktype = this.getRandomTrack();
|
||||
|
||||
if (this.currentMusic != null)
|
||||
if (this.mc.currentScreen instanceof GuiAetherMainMenu)
|
||||
{
|
||||
if (!this.mc.getSoundHandler().isSoundPlaying(this.currentMusic))
|
||||
{
|
||||
this.currentMusic = null;
|
||||
this.timeUntilNextMusic = Math.min(MathHelper.getRandomIntegerInRange(this.rand, tracktype.getMinDelay(), tracktype.getMaxDelay()), this.timeUntilNextMusic);
|
||||
}
|
||||
tracktype = TrackType.TRACK_MENU;
|
||||
}
|
||||
|
||||
this.timeUntilNextMusic = Math.min(this.timeUntilNextMusic, tracktype.getMaxDelay());
|
||||
|
||||
if (this.currentMusic == null && this.timeUntilNextMusic-- <= 0)
|
||||
if (this.mc.thePlayer != null && this.mc.thePlayer.dimension == AetherConfig.getAetherDimensionID() || this.mc.currentScreen instanceof GuiAetherMainMenu)
|
||||
{
|
||||
this.playMusic(tracktype);
|
||||
if (this.currentMusic != null)
|
||||
{
|
||||
if (!this.mc.getSoundHandler().isSoundPlaying(this.currentMusic))
|
||||
{
|
||||
this.currentMusic = null;
|
||||
this.timeUntilNextMusic = Math.min(MathHelper.getRandomIntegerInRange(this.rand, tracktype.getMinDelay(), tracktype.getMaxDelay()), this.timeUntilNextMusic);
|
||||
}
|
||||
}
|
||||
|
||||
this.timeUntilNextMusic = Math.min(this.timeUntilNextMusic, tracktype.getMaxDelay());
|
||||
|
||||
if (this.currentMusic == null && this.timeUntilNextMusic-- <= 0)
|
||||
{
|
||||
this.playMusic(tracktype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +87,8 @@ public class AetherMusicTicker implements ITickable
|
|||
TRACK_ONE(SoundsAether.aether1, 1200, 1500),
|
||||
TRACK_TWO(SoundsAether.aether2, 1200, 1500),
|
||||
TRACK_THREE(SoundsAether.aether3, 1200, 1500),
|
||||
TRACK_FOUR(SoundsAether.aether4, 1200, 1500);
|
||||
TRACK_FOUR(SoundsAether.aether4, 1200, 1500),
|
||||
TRACK_MENU(SoundsAether.aether_menu, 0, 5);
|
||||
|
||||
private final SoundEvent musicLocation;
|
||||
private final int minDelay;
|
||||
|
|
|
@ -46,6 +46,15 @@ public class AetherLoadingScreen extends LoadingScreenRenderer
|
|||
this.currentDisplayedTrivia = AetherTrivia.getNewTrivia();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayLoadingString(String message)
|
||||
{
|
||||
this.systemTime = 0L;
|
||||
this.message = message;
|
||||
this.setLoadingProgress(-1);
|
||||
this.systemTime = 0L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLoadingProgress(int progress)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
package com.legacy.aether.client.gui.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiAetherButton extends GuiButton
|
||||
{
|
||||
|
||||
protected static final ResourceLocation buttonTextures = new ResourceLocation("aether_legacy", "textures/gui/buttons.png");
|
||||
|
||||
public int scrollMax = 100;
|
||||
|
||||
public int scrollHeight = this.scrollMax;
|
||||
|
||||
public int scrollMin = 115;
|
||||
|
||||
public int scrollCrop = 20;
|
||||
|
||||
public int scrollCropMax = 90;
|
||||
|
||||
public boolean retracting = false;
|
||||
|
||||
public GuiAetherButton(int i, int j, int k, String s)
|
||||
{
|
||||
super(i, j, k, s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHoverState(boolean flag)
|
||||
{
|
||||
byte byte0 = 1;
|
||||
|
||||
if (!this.enabled)
|
||||
{
|
||||
byte0 = 0;
|
||||
}
|
||||
else if (flag)
|
||||
{
|
||||
if (byte0 < 2)
|
||||
{
|
||||
byte0++;
|
||||
}
|
||||
if (this.scrollCrop < this.scrollCropMax)
|
||||
{
|
||||
this.scrollCrop += 4;
|
||||
}
|
||||
if (this.scrollHeight < this.scrollMin)
|
||||
{
|
||||
this.scrollHeight += 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.scrollCrop > this.scrollCropMax)
|
||||
{
|
||||
this.scrollCrop -= 4;
|
||||
}
|
||||
if (this.scrollHeight > this.scrollMax)
|
||||
{
|
||||
this.scrollHeight -= 4;
|
||||
}
|
||||
if (this.scrollHeight == this.scrollMax)
|
||||
{
|
||||
this.retracting = false;
|
||||
}
|
||||
}
|
||||
|
||||
return byte0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int i, int j)
|
||||
{
|
||||
if (!this.visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
FontRenderer fontrenderer = minecraft.fontRendererObj;
|
||||
minecraft.renderEngine.bindTexture(buttonTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
boolean flag = i >= this.xPosition && j >= this.yPosition && i < this.xPosition + this.width && j < this.yPosition + this.height;
|
||||
int k = this.getHoverState(flag);
|
||||
this.drawTexturedModalRect(this.xPosition + this.scrollHeight - 90, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
|
||||
this.drawTexturedModalRect(this.xPosition + this.scrollHeight + this.width / 2 - 90, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height);
|
||||
this.mouseDragged(minecraft, i, j);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
if (!this.enabled)
|
||||
{
|
||||
this.drawString(fontrenderer, this.displayString, this.xPosition + this.width / 10 + this.scrollHeight - 80, this.yPosition + (this.height - 8) / 2, -6250336);
|
||||
}
|
||||
else if (flag)
|
||||
{
|
||||
this.drawString(fontrenderer, this.displayString, this.xPosition + this.width / 10 + this.scrollHeight - 80, this.yPosition + (this.height - 8) / 2, 0x77cccc);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drawString(fontrenderer, this.displayString, this.xPosition + this.width / 10 + this.scrollHeight - 80, this.yPosition + (this.height - 8) / 2, 14737632);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseDragged(Minecraft var1, int var2, int var3)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(int var1, int var2)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(Minecraft var1, int var2, int var3)
|
||||
{
|
||||
return this.enabled && this.visible && var2 >= this.xPosition && var3 >= this.yPosition && var2 < this.xPosition + this.width && var3 < this.yPosition + this.height;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.legacy.aether.client.gui.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
public class GuiDescButton extends GuiButton
|
||||
{
|
||||
|
||||
public String descText;
|
||||
|
||||
public GuiDescButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, String descText)
|
||||
{
|
||||
super(buttonId, x, y, widthIn, heightIn, buttonText);
|
||||
this.descText = descText;
|
||||
}
|
||||
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawButton(mc, mouseX, mouseY);
|
||||
|
||||
FontRenderer fontrenderer = mc.fontRendererObj;
|
||||
|
||||
if (this.visible && this.hovered)
|
||||
{
|
||||
if (this.displayString == "Q")
|
||||
{
|
||||
this.drawCenteredString(fontrenderer, this.descText, this.xPosition + (this.width + 50) / 2, this.yPosition + (this.height + 24) / 2, 0xfffffF);
|
||||
}
|
||||
else if (this.displayString == "W")
|
||||
{
|
||||
this.drawCenteredString(fontrenderer, this.descText, this.xPosition + (this.width - 50) / 2, this.yPosition + (this.height + 24) / 2, 0xfffffF);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drawCenteredString(fontrenderer, this.descText, this.xPosition + this.width / 2, this.yPosition + (this.height + 24) / 2, 0xfffffF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package com.legacy.aether.client.gui.menu;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.AnvilConverterException;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiDisconnected;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.world.storage.WorldSummary;
|
||||
import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.client.GuiAccessDenied;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
|
||||
public class AetherMenuHandler
|
||||
{
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private static boolean world_loaded, menu_loaded;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerLoggingOut(ActionPerformedEvent.Pre event)
|
||||
{
|
||||
GuiScreen gui = event.getGui();
|
||||
int id = event.getButton().id;
|
||||
|
||||
if (gui instanceof GuiDisconnected || gui instanceof GuiAccessDenied)
|
||||
{
|
||||
if (id == 0 || id == 1)
|
||||
{
|
||||
this.unloadWorld();
|
||||
this.loadWorld();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onOpenGui(GuiOpenEvent event)
|
||||
{
|
||||
if (event.getGui() == null && !world_loaded)
|
||||
{
|
||||
world_loaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientTick(TickEvent.ClientTickEvent event) throws Exception
|
||||
{
|
||||
TickEvent.Phase phase = event.phase;
|
||||
TickEvent.Type type = event.type;
|
||||
|
||||
if (phase == TickEvent.Phase.END)
|
||||
{
|
||||
if (type.equals(TickEvent.Type.CLIENT))
|
||||
{
|
||||
this.updateMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMenu() throws Exception
|
||||
{
|
||||
GuiScreen screen = this.mc.currentScreen;
|
||||
|
||||
if (screen != null && screen.getClass() == GuiMainMenu.class)
|
||||
{
|
||||
this.unloadWorld();
|
||||
|
||||
if (this.mc.getSaveLoader().getSaveList().size() <= 0)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiAetherMainMenuFallback());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.loadWorld();
|
||||
}
|
||||
}
|
||||
|
||||
if (world_loaded)
|
||||
{
|
||||
if (!(screen instanceof GuiAetherMainMenu) && !menu_loaded)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiAetherMainMenu(false));
|
||||
menu_loaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadWorld()
|
||||
{
|
||||
if (this.mc.theWorld != null)
|
||||
{
|
||||
this.mc.theWorld.sendQuittingDisconnectingPacket();
|
||||
}
|
||||
|
||||
FMLClientHandler.instance().tryLoadExistingWorld(null, this.getWorldSummary(0));
|
||||
}
|
||||
|
||||
public void unloadWorld()
|
||||
{
|
||||
world_loaded = false;
|
||||
menu_loaded = false;
|
||||
}
|
||||
|
||||
protected WorldSummary getWorldSummary(int fileNumber)
|
||||
{
|
||||
WorldSummary s = null;
|
||||
List<WorldSummary> list = null;
|
||||
|
||||
try
|
||||
{
|
||||
list = this.mc.getSaveLoader().getSaveList();
|
||||
Collections.sort(list);
|
||||
s = list.get(fileNumber);
|
||||
}
|
||||
catch (AnvilConverterException e) { e.printStackTrace(); }
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,262 @@
|
|||
package com.legacy.aether.client.gui.menu;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiButtonLanguage;
|
||||
import net.minecraft.client.gui.GuiLanguage;
|
||||
import net.minecraft.client.gui.GuiMultiplayer;
|
||||
import net.minecraft.client.gui.GuiOptions;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiWorldSelection;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.GameType;
|
||||
import net.minecraftforge.fml.client.GuiModList;
|
||||
|
||||
import org.apache.commons.io.Charsets;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.legacy.aether.client.gui.button.GuiAetherButton;
|
||||
import com.legacy.aether.client.gui.button.GuiDescButton;
|
||||
import com.legacy.aether.client.gui.menu.hook.GuiMultiplayerHook;
|
||||
import com.legacy.aether.client.gui.menu.hook.GuiWorldSelectionHook;
|
||||
import com.legacy.aether.server.networking.AetherNetworkingManager;
|
||||
import com.legacy.aether.server.networking.packets.PacketGameType;
|
||||
|
||||
public class GuiAetherMainMenu extends GuiScreen
|
||||
{
|
||||
|
||||
private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("textures/gui/title/minecraft.png");
|
||||
|
||||
private static final ResourceLocation aetherTitleTextures = new ResourceLocation("aether_legacy", "textures/gui/title/aether.png");
|
||||
|
||||
private static final ResourceLocation splashTexts = new ResourceLocation("texts/splashes.txt");
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
private String splashText;
|
||||
|
||||
public Minecraft mc;
|
||||
|
||||
private boolean style;
|
||||
|
||||
public boolean worldLoaded;
|
||||
|
||||
public GuiAetherMainMenu(boolean style)
|
||||
{
|
||||
this.mc = Minecraft.getMinecraft();
|
||||
this.style = style;
|
||||
|
||||
this.splashText = "missingno";
|
||||
IResource iresource = null;
|
||||
|
||||
try
|
||||
{
|
||||
List<String> list = Lists.<String>newArrayList();
|
||||
iresource = Minecraft.getMinecraft().getResourceManager().getResource(splashTexts);
|
||||
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8));
|
||||
String s;
|
||||
|
||||
while ((s = bufferedreader.readLine()) != null)
|
||||
{
|
||||
s = s.trim();
|
||||
|
||||
if (!s.isEmpty())
|
||||
{
|
||||
list.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
this.splashText = (String)list.get(RANDOM.nextInt(list.size()));
|
||||
|
||||
if (this.splashText.hashCode() != 125780783)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException var8)
|
||||
{
|
||||
;
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly((Closeable)iresource);
|
||||
}
|
||||
|
||||
AetherNetworkingManager.sendToServer(new PacketGameType(GameType.SPECTATOR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen()
|
||||
{
|
||||
if(this.mc.thePlayer != null)
|
||||
{
|
||||
this.mc.thePlayer.rotationYaw += 0.2F;
|
||||
this.mc.thePlayer.rotationPitch = 0F;
|
||||
}
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
if (this.mc.thePlayer != null)
|
||||
{
|
||||
AetherNetworkingManager.sendToServer(new PacketGameType(GameType.SURVIVAL));
|
||||
}
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
if (calendar.get(2) + 1 == 12 && calendar.get(5) == 24)
|
||||
{
|
||||
this.splashText = "Merry X-mas!";
|
||||
}
|
||||
else if (calendar.get(2) + 1 == 1 && calendar.get(5) == 1)
|
||||
{
|
||||
this.splashText = "Happy new year!";
|
||||
}
|
||||
else if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31)
|
||||
{
|
||||
this.splashText = "OOoooOOOoooo! Spooky!";
|
||||
}
|
||||
|
||||
this.mc.gameSettings.hideGUI = true;
|
||||
|
||||
int var5 = height / 4 + 20;
|
||||
|
||||
if (!this.style)
|
||||
{
|
||||
this.buttonList.add(new GuiAetherButton(0, width / 70, var5 + 72, "Options"));
|
||||
this.buttonList.add(new GuiAetherButton(1, width / 70, var5, "Singleplayer"));
|
||||
this.buttonList.add(new GuiAetherButton(2, width / 70, var5 + 24, "Multiplayer"));
|
||||
this.buttonList.add(new GuiAetherButton(3, width / 70, var5 + 48, "Mods"));
|
||||
this.buttonList.add(new GuiAetherButton(4, width / 70, var5 + 96, "Quit"));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.buttonList.add(new GuiButton(0, width / 70, var5 + 72, "Options"));
|
||||
this.buttonList.add(new GuiButton(1, width / 70, var5, "Singleplayer"));
|
||||
this.buttonList.add(new GuiButton(2, width / 70, var5 + 24, "Multiplayer"));
|
||||
this.buttonList.add(new GuiButton(3, width / 70, var5 + 48, "Mods"));
|
||||
this.buttonList.add(new GuiButton(4, width / 70, var5 + 96, "Quit"));
|
||||
}
|
||||
|
||||
this.buttonList.add(new GuiDescButton(5, width - 24, 4, 20, 20, "W", "Toggle World"));
|
||||
this.buttonList.add(new GuiDescButton(6, width - 48, 4, 20, 20, "T", "Toggle Theme"));
|
||||
this.buttonList.add(new GuiButtonLanguage(7, this.width - 96, 4));
|
||||
this.buttonList.add(new GuiDescButton(8, width - 72, 4, 20, 20, "Q", "Quick Load"));
|
||||
}
|
||||
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
byte var6 = 15;
|
||||
byte var7 = 15;
|
||||
this.mc.getTextureManager().bindTexture(style ? minecraftTitleTextures : aetherTitleTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
drawTexturedModalRect(var6 + 0, var7 + 0, 0, 0, 155, 44);
|
||||
drawTexturedModalRect(var6 + 155, var7 + 0, 0, 45, 155, 44);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(!this.style ? 180.0F : 270.0F,!this.style ? 60.0F : 50.0F, 0.0F);
|
||||
GlStateManager.rotate(-20.0F, 0.0F, 0.0F, 1.0F);
|
||||
float f = 1.8F - MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) / 1000.0F * ((float)Math.PI * 2F)) * 0.1F);
|
||||
f = f * 100.0F / (float)(this.fontRendererObj.getStringWidth(this.splashText) + 32);
|
||||
GlStateManager.scale(f, f, f);
|
||||
this.drawCenteredString(this.fontRendererObj, this.splashText, 0, -8, -256);
|
||||
GlStateManager.popMatrix();
|
||||
drawFooter();
|
||||
}
|
||||
|
||||
private void drawFooter()
|
||||
{
|
||||
String version = "Minecraft 1.10.2";
|
||||
String copyright = "Copyright Mojang AB. Do not distribute.";
|
||||
String modTitle = "Aether Pre-1.10.2";
|
||||
String modSubtitle = "Creation of Gilded Games";
|
||||
|
||||
drawString(fontRendererObj, version, width - fontRendererObj.getStringWidth(version) - 5, height - 20, 0xFFFFFF);
|
||||
drawString(fontRendererObj, copyright, width - fontRendererObj.getStringWidth(copyright) - 5, height - 10, 0x707070);
|
||||
drawString(fontRendererObj, modTitle, 5, height - 20, 0xFFFFFF);
|
||||
drawString(fontRendererObj, modSubtitle, 5, height - 10, 0x707070);
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton button) throws IOException
|
||||
{
|
||||
if (button.id == 0)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
|
||||
}
|
||||
|
||||
if (button.id == 1)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiWorldSelectionHook(this));
|
||||
}
|
||||
|
||||
if (button.id == 2)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiMultiplayerHook(this));
|
||||
}
|
||||
|
||||
if (button.id == 3)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiModList(this));
|
||||
}
|
||||
|
||||
if (button.id == 4)
|
||||
{
|
||||
this.mc.shutdown();
|
||||
}
|
||||
|
||||
if (button.id == 5)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiAetherMainMenuFallback());
|
||||
}
|
||||
|
||||
if (button.id == 6)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiAetherMainMenu(this.style ? false : true));
|
||||
}
|
||||
|
||||
if (button.id == 7)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
|
||||
}
|
||||
|
||||
if (button.id == 8)
|
||||
{
|
||||
AetherNetworkingManager.sendToServer(new PacketGameType(GameType.SURVIVAL));
|
||||
Minecraft.getMinecraft().gameSettings.hideGUI = false;
|
||||
this.mc.displayGuiScreen(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void onGuiClosed()
|
||||
{
|
||||
AetherNetworkingManager.sendToServer(new PacketGameType(GameType.SURVIVAL));
|
||||
}
|
||||
|
||||
public boolean doesGuiPauseGame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,499 @@
|
|||
package com.legacy.aether.client.gui.menu;
|
||||
|
||||
import static net.minecraftforge.common.ForgeVersion.Status.BETA;
|
||||
import static net.minecraftforge.common.ForgeVersion.Status.BETA_OUTDATED;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.AnvilConverterException;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiButtonLanguage;
|
||||
import net.minecraft.client.gui.GuiConfirmOpenLink;
|
||||
import net.minecraft.client.gui.GuiLanguage;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import net.minecraft.client.gui.GuiMultiplayer;
|
||||
import net.minecraft.client.gui.GuiOptions;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiWorldSelection;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.storage.ISaveFormat;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
import net.minecraftforge.common.ForgeVersion;
|
||||
import net.minecraftforge.common.ForgeVersion.Status;
|
||||
import net.minecraftforge.fml.client.GuiModList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
import org.lwjgl.util.glu.Project;
|
||||
|
||||
import com.legacy.aether.client.gui.button.GuiDescButton;
|
||||
import com.legacy.aether.client.gui.menu.hook.GuiMultiplayerHook;
|
||||
import com.legacy.aether.client.gui.menu.hook.GuiWorldSelectionHook;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiAetherMainMenuFallback extends GuiScreen implements GuiYesNoCallback
|
||||
{
|
||||
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
private float updateCounter;
|
||||
|
||||
private GuiButton buttonResetDemo;
|
||||
|
||||
private int panoramaTimer;
|
||||
|
||||
private DynamicTexture viewportTexture;
|
||||
|
||||
private final Object threadLock = new Object();
|
||||
|
||||
private String openGLWarning1;
|
||||
|
||||
private String openGLWarning2;
|
||||
|
||||
private String openGLWarningLink;
|
||||
|
||||
private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("aether_legacy", "textures/gui/title/aether.png");
|
||||
|
||||
private static final ResourceLocation[] titlePanoramaPaths =
|
||||
new ResourceLocation[] {new ResourceLocation("aether_legacy", "textures/gui/title/panorama/panorama_0.png"), new ResourceLocation("aether_legacy", "textures/gui/title/panorama/panorama_1.png"), new ResourceLocation("aether_legacy", "textures/gui/title/panorama/panorama_2.png"), new ResourceLocation("aether_legacy", "textures/gui/title/panorama/panorama_3.png"), new ResourceLocation("aether_legacy", "textures/gui/title/panorama/panorama_4.png"), new ResourceLocation("aether_legacy", "textures/gui/title/panorama/panorama_5.png")};
|
||||
public static final String field_96138_a = "Please click " + TextFormatting.UNDERLINE + "here" + TextFormatting.RESET + " for more information.";
|
||||
private int field_92024_r;
|
||||
private int field_92023_s;
|
||||
private int field_92022_t;
|
||||
private int field_92021_u;
|
||||
private int field_92020_v;
|
||||
private int field_92019_w;
|
||||
private ResourceLocation backgroundTexture;
|
||||
|
||||
public GuiAetherMainMenuFallback()
|
||||
{
|
||||
this.openGLWarning2 = field_96138_a;
|
||||
|
||||
this.updateCounter = RANDOM.nextFloat();
|
||||
this.openGLWarning1 = "";
|
||||
|
||||
if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.areShadersSupported())
|
||||
{
|
||||
this.openGLWarning1 = I18n.format("title.oldgl1", new Object[0]);
|
||||
this.openGLWarning2 = I18n.format("title.oldgl2", new Object[0]);
|
||||
this.openGLWarningLink = "https://help.mojang.com/customer/portal/articles/325948?ref=game";
|
||||
}
|
||||
}
|
||||
|
||||
public void updateScreen()
|
||||
{
|
||||
++this.panoramaTimer;
|
||||
}
|
||||
|
||||
public boolean doesGuiPauseGame()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void keyTyped(char typedChar, int keyCode) throws IOException
|
||||
{
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
this.viewportTexture = new DynamicTexture(256, 256);
|
||||
this.backgroundTexture = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture);
|
||||
|
||||
int j = this.height / 4 + 48;
|
||||
|
||||
if (this.mc.isDemo())
|
||||
{
|
||||
this.addDemoButtons(j, 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.addSingleplayerMultiplayerButtons(j, 24);
|
||||
}
|
||||
|
||||
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, j + 72 + 12, 98, 20, I18n.format("menu.options", new Object[0])));
|
||||
this.buttonList.add(new GuiButton(4, this.width / 2 + 2, j + 72 + 12, 98, 20, I18n.format("menu.quit", new Object[0])));
|
||||
this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, j + 72 + 12));
|
||||
this.buttonList.add(new GuiDescButton(7, width - 24, 4, 20, 20, "W", "Toggle World"));
|
||||
this.buttonList.add(new GuiDescButton(8, width - 48, 4, 20, 20, "T", "Toggle Theme"));
|
||||
|
||||
try
|
||||
{
|
||||
if (Minecraft.getMinecraft().getSaveLoader().getSaveList().size() <= 0)
|
||||
{
|
||||
this.buttonList.get(7).enabled = false;
|
||||
}
|
||||
}
|
||||
catch (AnvilConverterException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
synchronized (this.threadLock)
|
||||
{
|
||||
this.field_92023_s = this.fontRendererObj.getStringWidth(this.openGLWarning1);
|
||||
this.field_92024_r = this.fontRendererObj.getStringWidth(this.openGLWarning2);
|
||||
int k = Math.max(this.field_92023_s, this.field_92024_r);
|
||||
this.field_92022_t = (this.width - k) / 2;
|
||||
this.field_92021_u = ((GuiButton)this.buttonList.get(0)).yPosition - 24;
|
||||
this.field_92020_v = this.field_92022_t + k;
|
||||
this.field_92019_w = this.field_92021_u + 24;
|
||||
}
|
||||
}
|
||||
|
||||
private void addSingleplayerMultiplayerButtons(int p_73969_1_, int p_73969_2_)
|
||||
{
|
||||
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0])));
|
||||
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0])));
|
||||
this.buttonList.add(new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 200, 20, I18n.format("fml.menu.mods")));
|
||||
}
|
||||
|
||||
private void addDemoButtons(int p_73972_1_, int p_73972_2_)
|
||||
{
|
||||
this.buttonList.add(new GuiButton(11, this.width / 2 - 100, p_73972_1_, I18n.format("menu.playdemo", new Object[0])));
|
||||
this.buttonList.add(this.buttonResetDemo = new GuiButton(12, this.width / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.format("menu.resetdemo", new Object[0])));
|
||||
ISaveFormat isaveformat = this.mc.getSaveLoader();
|
||||
WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");
|
||||
|
||||
if (worldinfo == null)
|
||||
{
|
||||
this.buttonResetDemo.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton button) throws IOException
|
||||
{
|
||||
if (button.id == 0)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
|
||||
}
|
||||
|
||||
if (button.id == 5)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
|
||||
}
|
||||
|
||||
if (button.id == 1)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiWorldSelectionHook(this));
|
||||
}
|
||||
|
||||
if (button.id == 2)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiMultiplayerHook(this));
|
||||
}
|
||||
|
||||
if (button.id == 4)
|
||||
{
|
||||
this.mc.shutdown();
|
||||
}
|
||||
|
||||
if (button.id == 6)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiModList(this));
|
||||
}
|
||||
|
||||
if (button.id == 7)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiMainMenu());
|
||||
}
|
||||
|
||||
if (button.id == 8)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiMainMenuFallback());
|
||||
}
|
||||
}
|
||||
|
||||
public void confirmClicked(boolean result, int id)
|
||||
{
|
||||
if (result && id == 12)
|
||||
{
|
||||
ISaveFormat isaveformat = this.mc.getSaveLoader();
|
||||
isaveformat.flushCache();
|
||||
isaveformat.deleteWorldDirectory("Demo_World");
|
||||
this.mc.displayGuiScreen(this);
|
||||
}
|
||||
else if (id == 13)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
try
|
||||
{
|
||||
Class<?> oclass = Class.forName("java.awt.Desktop");
|
||||
Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
|
||||
oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {new URI(this.openGLWarningLink)});
|
||||
}
|
||||
catch (Throwable throwable)
|
||||
{
|
||||
logger.error("Couldn\'t open link", throwable);
|
||||
}
|
||||
}
|
||||
|
||||
this.mc.displayGuiScreen(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawPanorama(int p_73970_1_, int p_73970_2_, float p_73970_3_)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer worldrenderer = tessellator.getBuffer();
|
||||
GlStateManager.matrixMode(5889);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.loadIdentity();
|
||||
Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
|
||||
GlStateManager.matrixMode(5888);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.loadIdentity();
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.depthMask(false);
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
int i = 8;
|
||||
|
||||
for (int j = 0; j < i * i; ++j)
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
float f = ((float)(j % i) / (float)i - 0.5F) / 64.0F;
|
||||
float f1 = ((float)(j / i) / (float)i - 0.5F) / 64.0F;
|
||||
float f2 = 0.0F;
|
||||
GlStateManager.translate(f, f1, f2);
|
||||
GlStateManager.rotate(MathHelper.sin(((float)this.panoramaTimer + p_73970_3_) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(-((float)this.panoramaTimer + p_73970_3_) * 0.1F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
for (int k = 0; k < 6; ++k)
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
if (k == 1)
|
||||
{
|
||||
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (k == 2)
|
||||
{
|
||||
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (k == 3)
|
||||
{
|
||||
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (k == 4)
|
||||
{
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (k == 5)
|
||||
{
|
||||
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
this.mc.getTextureManager().bindTexture(titlePanoramaPaths[k]);
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
int l = 255 / (j + 1);
|
||||
worldrenderer.pos(-1.0D, -1.0D, 1.0D).tex(0.0D, 0.0D).color(255, 255, 255, l).endVertex();
|
||||
worldrenderer.pos(1.0D, -1.0D, 1.0D).tex(1.0D, 0.0D).color(255, 255, 255, l).endVertex();
|
||||
worldrenderer.pos(1.0D, 1.0D, 1.0D).tex(1.0D, 1.0D).color(255, 255, 255, l).endVertex();
|
||||
worldrenderer.pos(-1.0D, 1.0D, 1.0D).tex(0.0D, 1.0D).color(255, 255, 255, l).endVertex();
|
||||
tessellator.draw();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.colorMask(true, true, true, false);
|
||||
}
|
||||
|
||||
worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
|
||||
GlStateManager.colorMask(true, true, true, true);
|
||||
GlStateManager.matrixMode(5889);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(5888);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.enableDepth();
|
||||
}
|
||||
|
||||
private void rotateAndBlurSkybox(float p_73968_1_)
|
||||
{
|
||||
this.mc.getTextureManager().bindTexture(this.backgroundTexture);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
|
||||
GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.colorMask(true, true, true, false);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer worldrenderer = tessellator.getBuffer();
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
GlStateManager.disableAlpha();
|
||||
int i = 3;
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
float f = 1.0F / (float)(j + 1);
|
||||
int k = this.width;
|
||||
int l = this.height;
|
||||
float f1 = (float)(j - i / 2) / 256.0F;
|
||||
worldrenderer.pos((double)k, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
|
||||
worldrenderer.pos((double)k, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
|
||||
worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
|
||||
worldrenderer.pos(0.0D, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.colorMask(true, true, true, true);
|
||||
}
|
||||
|
||||
private void renderSkybox(int p_73971_1_, int p_73971_2_, float p_73971_3_)
|
||||
{
|
||||
this.mc.getFramebuffer().unbindFramebuffer();
|
||||
GlStateManager.viewport(0, 0, 256, 256);
|
||||
this.drawPanorama(p_73971_1_, p_73971_2_, p_73971_3_);
|
||||
this.rotateAndBlurSkybox(p_73971_3_);
|
||||
this.rotateAndBlurSkybox(p_73971_3_);
|
||||
this.rotateAndBlurSkybox(p_73971_3_);
|
||||
this.rotateAndBlurSkybox(p_73971_3_);
|
||||
this.rotateAndBlurSkybox(p_73971_3_);
|
||||
this.rotateAndBlurSkybox(p_73971_3_);
|
||||
this.rotateAndBlurSkybox(p_73971_3_);
|
||||
this.mc.getFramebuffer().bindFramebuffer(true);
|
||||
GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
|
||||
float f = this.width > this.height ? 120.0F / (float)this.width : 120.0F / (float)this.height;
|
||||
float f1 = (float)this.height * f / 256.0F;
|
||||
float f2 = (float)this.width * f / 256.0F;
|
||||
int i = this.width;
|
||||
int j = this.height;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer worldrenderer = tessellator.getBuffer();
|
||||
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
worldrenderer.pos(0.0D, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
|
||||
worldrenderer.pos((double)i, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
|
||||
worldrenderer.pos((double)i, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
|
||||
worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
GlStateManager.disableAlpha();
|
||||
this.renderSkybox(mouseX, mouseY, partialTicks);
|
||||
GlStateManager.enableAlpha();
|
||||
int i = 208;
|
||||
int j = this.width / 2 - i / 2;
|
||||
int k = 30;
|
||||
this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
|
||||
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
|
||||
this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
if ((double)this.updateCounter < 1.0E-4D)
|
||||
{
|
||||
this.drawTexturedModalRect(j + 0, k + 0, 0, 0, 99, 44);
|
||||
this.drawTexturedModalRect(j + 99, k + 0, 129, 0, 27, 44);
|
||||
this.drawTexturedModalRect(j + 99 + 26, k + 0, 126, 0, 3, 44);
|
||||
this.drawTexturedModalRect(j + 99 + 26 + 3, k + 0, 99, 0, 26, 44);
|
||||
this.drawTexturedModalRect(j + 155, k + 0, 0, 45, 155, 44);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drawTexturedModalRect(j + 0, k + 0, 0, 0, 155, 44);
|
||||
this.drawTexturedModalRect(j + 155, k + 0, 0, 45, 155, 44);
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float)(this.width / 2 + 90), 70.0F, 0.0F);
|
||||
GlStateManager.rotate(-20.0F, 0.0F, 0.0F, 1.0F);
|
||||
GlStateManager.popMatrix();
|
||||
String s = "Minecraft 1.10.2";
|
||||
|
||||
if (this.mc.isDemo())
|
||||
{
|
||||
s = s + " Demo";
|
||||
}
|
||||
|
||||
java.util.List<String> brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true));
|
||||
for (int brdline = 0; brdline < brandings.size(); brdline++)
|
||||
{
|
||||
String brd = brandings.get(brdline);
|
||||
if (!com.google.common.base.Strings.isNullOrEmpty(brd))
|
||||
{
|
||||
this.drawString(this.fontRendererObj, brd, 2, this.height - ( 10 + brdline * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215);
|
||||
}
|
||||
}
|
||||
|
||||
Status status = ForgeVersion.getStatus();
|
||||
if (status == BETA || status == BETA_OUTDATED)
|
||||
{
|
||||
// render a warning at the top of the screen,
|
||||
String line = I18n.format("forge.update.beta.1", TextFormatting.RED, TextFormatting.RESET);
|
||||
this.drawString(this.fontRendererObj, line, (width - this.fontRendererObj.getStringWidth(line)) / 2, 4 + (0 * (this.fontRendererObj.FONT_HEIGHT + 1)), -1);
|
||||
line = I18n.format("forge.update.beta.2");
|
||||
this.drawString(this.fontRendererObj, line, (width - this.fontRendererObj.getStringWidth(line)) / 2, 4 + (1 * (this.fontRendererObj.FONT_HEIGHT + 1)), -1);
|
||||
}
|
||||
|
||||
String line = null;
|
||||
switch(status)
|
||||
{
|
||||
case OUTDATED:
|
||||
case BETA_OUTDATED: line = I18n.format("forge.update.newversion", ForgeVersion.getTarget()); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (line != null)
|
||||
{
|
||||
this.drawString(this.fontRendererObj, line, width - this.fontRendererObj.getStringWidth(line) - 2, height - (2 * (this.fontRendererObj.FONT_HEIGHT + 1)), -1);
|
||||
}
|
||||
|
||||
String s1 = "Copyright Mojang AB. Do not distribute!";
|
||||
this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1);
|
||||
|
||||
if (this.openGLWarning1 != null && this.openGLWarning1.length() > 0)
|
||||
{
|
||||
drawRect(this.field_92022_t - 2, this.field_92021_u - 2, this.field_92020_v + 2, this.field_92019_w - 1, 1428160512);
|
||||
this.drawString(this.fontRendererObj, this.openGLWarning1, this.field_92022_t, this.field_92021_u, -1);
|
||||
this.drawString(this.fontRendererObj, this.openGLWarning2, (this.width - this.field_92024_r) / 2, ((GuiButton)this.buttonList.get(0)).yPosition - 12, -1);
|
||||
}
|
||||
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
synchronized (this.threadLock)
|
||||
{
|
||||
if (this.openGLWarning1.length() > 0 && mouseX >= this.field_92022_t && mouseX <= this.field_92020_v && mouseY >= this.field_92021_u && mouseY <= this.field_92019_w)
|
||||
{
|
||||
GuiConfirmOpenLink guiconfirmopenlink = new GuiConfirmOpenLink(this, this.openGLWarningLink, 13, true);
|
||||
guiconfirmopenlink.disableSecurityWarning();
|
||||
this.mc.displayGuiScreen(guiconfirmopenlink);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.legacy.aether.client.gui.menu;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
|
||||
import com.legacy.aether.client.gui.button.GuiDescButton;
|
||||
import com.legacy.aether.client.gui.menu.hook.GuiMultiplayerHook;
|
||||
import com.legacy.aether.client.gui.menu.hook.GuiWorldSelectionHook;
|
||||
|
||||
public class GuiMainMenuFallback extends GuiMainMenu
|
||||
{
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
this.buttonList.add(new GuiDescButton(7, width - 24, 4, 20, 20, "W", "Toggle World"));
|
||||
this.buttonList.add(new GuiDescButton(8, width - 48, 4, 20, 20, "T", "Toggle Theme"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton button) throws IOException
|
||||
{
|
||||
super.actionPerformed(button);
|
||||
|
||||
if (button.id == 1)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiWorldSelectionHook(this));
|
||||
}
|
||||
|
||||
if (button.id == 2)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiMultiplayerHook(this));
|
||||
}
|
||||
|
||||
if (button.id == 7)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiMainMenu());
|
||||
}
|
||||
|
||||
if (button.id == 8)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiAetherMainMenuFallback());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.legacy.aether.client.gui.menu.hook;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiListWorldSelection;
|
||||
import net.minecraft.client.gui.GuiListWorldSelectionEntry;
|
||||
import net.minecraft.client.gui.GuiWorldSelection;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.world.storage.ISaveFormat;
|
||||
import net.minecraft.world.storage.WorldSummary;
|
||||
|
||||
public class GuiListWorldSelectionEntryHook extends GuiListWorldSelectionEntry
|
||||
{
|
||||
|
||||
private Minecraft client;
|
||||
|
||||
private WorldSummary worldSummary;
|
||||
|
||||
private GuiWorldSelection worldSelScreen;
|
||||
|
||||
public GuiListWorldSelectionEntryHook(GuiListWorldSelection listWorldSelIn, WorldSummary worldSummary, ISaveFormat p_i46591_3_)
|
||||
{
|
||||
super(listWorldSelIn, worldSummary, p_i46591_3_);
|
||||
|
||||
this.worldSummary = worldSummary;
|
||||
this.client = Minecraft.getMinecraft();
|
||||
this.worldSelScreen = listWorldSelIn.getGuiWorldSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void joinWorld()
|
||||
{
|
||||
if (this.worldSummary.askToOpenWorld())
|
||||
{
|
||||
this.client.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback()
|
||||
{
|
||||
public void confirmClicked(boolean result, int id)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
GuiListWorldSelectionEntryHook.this.loadWorld();
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiListWorldSelectionEntryHook.this.client.displayGuiScreen(GuiListWorldSelectionEntryHook.this.worldSelScreen);
|
||||
}
|
||||
}
|
||||
}, I18n.format("selectWorld.versionQuestion", new Object[0]), I18n.format("selectWorld.versionWarning", new Object[] {this.worldSummary.getVersionName()}), I18n.format("selectWorld.versionJoinButton", new Object[0]), I18n.format("gui.cancel", new Object[0]), 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.loadWorld();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadWorld()
|
||||
{
|
||||
this.client.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||
|
||||
if (this.client.getSaveLoader().canLoadWorld(this.worldSummary.getFileName()))
|
||||
{
|
||||
if (this.client.theWorld != null)
|
||||
{
|
||||
this.client.theWorld.sendQuittingDisconnectingPacket();
|
||||
}
|
||||
|
||||
net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(worldSelScreen, this.worldSummary);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.legacy.aether.client.gui.menu.hook;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.client.AnvilConverterException;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiErrorScreen;
|
||||
import net.minecraft.client.gui.GuiListWorldSelection;
|
||||
import net.minecraft.client.gui.GuiListWorldSelectionEntry;
|
||||
import net.minecraft.world.storage.ISaveFormat;
|
||||
import net.minecraft.world.storage.WorldSummary;
|
||||
|
||||
public class GuiListWorldSelectionHook extends GuiListWorldSelection
|
||||
{
|
||||
|
||||
private final List<GuiListWorldSelectionEntryHook> entries = Lists.<GuiListWorldSelectionEntryHook>newArrayList();
|
||||
|
||||
public GuiListWorldSelectionHook(GuiWorldSelectionHook screen)
|
||||
{
|
||||
super(screen, Minecraft.getMinecraft(), screen.width, screen.height, 32, screen.height - 64, 36);
|
||||
this.refreshList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshList()
|
||||
{
|
||||
ISaveFormat isaveformat = this.mc.getSaveLoader();
|
||||
List<WorldSummary> list;
|
||||
|
||||
try
|
||||
{
|
||||
list = isaveformat.getSaveList();
|
||||
}
|
||||
catch (AnvilConverterException anvilconverterexception)
|
||||
{
|
||||
this.mc.displayGuiScreen(new GuiErrorScreen("Unable to load worlds", anvilconverterexception.getMessage()));
|
||||
return;
|
||||
}
|
||||
|
||||
Collections.sort(list);
|
||||
|
||||
for (WorldSummary worldsummary : list)
|
||||
{
|
||||
if (this.entries != null)
|
||||
this.entries.add(new GuiListWorldSelectionEntryHook(this, worldsummary, this.mc.getSaveLoader()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiListWorldSelectionEntry getListEntry(int index)
|
||||
{
|
||||
return (GuiListWorldSelectionEntry)this.entries.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSize()
|
||||
{
|
||||
return this.entries.size();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package com.legacy.aether.client.gui.menu.hook;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiListExtended;
|
||||
import net.minecraft.client.gui.GuiMultiplayer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ServerListEntryLanDetected;
|
||||
import net.minecraft.client.gui.ServerListEntryNormal;
|
||||
import net.minecraft.client.gui.ServerSelectionList;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraft.client.network.LanServerInfo;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
public class GuiMultiplayerHook extends GuiMultiplayer
|
||||
{
|
||||
|
||||
private boolean directConnect;
|
||||
|
||||
private ServerSelectionList list;
|
||||
|
||||
public GuiMultiplayerHook(GuiScreen parentScreen)
|
||||
{
|
||||
super(parentScreen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
this.list = ObfuscationReflectionHelper.getPrivateValue(GuiMultiplayer.class, this, "serverListSelector", "field_146803_h");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) throws IOException
|
||||
{
|
||||
if (button.enabled)
|
||||
{
|
||||
if (button.id == 4)
|
||||
{
|
||||
this.directConnect = true;
|
||||
}
|
||||
}
|
||||
|
||||
super.actionPerformed(button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectToSelected()
|
||||
{
|
||||
GuiListExtended.IGuiListEntry guilistextended$iguilistentry = this.list.getSelected() < 0 ? null : this.list.getListEntry(this.list.getSelected());
|
||||
|
||||
if (guilistextended$iguilistentry instanceof ServerListEntryNormal)
|
||||
{
|
||||
this.connectToServer(((ServerListEntryNormal)guilistextended$iguilistentry).getServerData());
|
||||
}
|
||||
else if (guilistextended$iguilistentry instanceof ServerListEntryLanDetected)
|
||||
{
|
||||
LanServerInfo lanserverinfo = ((ServerListEntryLanDetected)guilistextended$iguilistentry).getServerData();
|
||||
this.connectToServer(new ServerData(lanserverinfo.getServerMotd(), lanserverinfo.getServerIpPort(), true));
|
||||
}
|
||||
}
|
||||
|
||||
private void connectToServer(ServerData server)
|
||||
{
|
||||
if (this.mc.theWorld != null)
|
||||
{
|
||||
this.mc.theWorld.sendQuittingDisconnectingPacket();
|
||||
}
|
||||
|
||||
net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServer(this, server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmClicked(boolean result, int id)
|
||||
{
|
||||
if (this.directConnect)
|
||||
{
|
||||
this.directConnect = false;
|
||||
|
||||
if (result)
|
||||
{
|
||||
ServerData selectedServer = ObfuscationReflectionHelper.getPrivateValue(GuiMultiplayer.class, this, "selectedServer", "field_146811_z");
|
||||
this.connectToServer(selectedServer);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.mc.displayGuiScreen(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.legacy.aether.client.gui.menu.hook;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiWorldSelection;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
public class GuiWorldSelectionHook extends GuiWorldSelection
|
||||
{
|
||||
|
||||
public GuiWorldSelectionHook(GuiScreen screenIn)
|
||||
{
|
||||
super(screenIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
ObfuscationReflectionHelper.setPrivateValue(GuiWorldSelection.class, this, new GuiListWorldSelectionHook(this), "selectionList", "field_184866_u");
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ import net.minecraftforge.common.config.Configuration;
|
|||
public class AetherConfig
|
||||
{
|
||||
|
||||
private static boolean christmas_content;
|
||||
private static boolean aether_menu, christmas_content;
|
||||
|
||||
private static int aether_biome_id, aether_dimension_id;
|
||||
|
||||
|
@ -31,6 +31,7 @@ public class AetherConfig
|
|||
|
||||
config.load();
|
||||
|
||||
aether_menu = config.get("Aether Menu Options", "Use Aether Menu", false).getBoolean(false);
|
||||
christmas_content = config.get("Aether World Generation", "Christmas Content", false).getBoolean(false);
|
||||
|
||||
aether_dimension_id = config.get("World Identification", "Aether Dimension ID", 4).getInt(4);
|
||||
|
@ -51,6 +52,11 @@ public class AetherConfig
|
|||
return AetherConfig.aether_biome_id;
|
||||
}
|
||||
|
||||
public static boolean shouldUseAetherMenu()
|
||||
{
|
||||
return AetherConfig.aether_menu;
|
||||
}
|
||||
|
||||
public static boolean shouldLoadHolidayContent()
|
||||
{
|
||||
return AetherConfig.christmas_content;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.legacy.aether.server;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.boss.EntityWither;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
@ -21,9 +19,6 @@ import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
|||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
|
||||
|
|
Loading…
Reference in a new issue