Résolu Get la texture d'un joueur
-
Bonsoir !
Je cherche à prendre l’URL de la texture d’un joueur le http://skins.minecraft.net et à l’appliquer à mon modèle comme une texture normale !
Tout (du moins je l’espère) ce passe du côté du ResourceLocation donc voilà ma ligne de code
private static final ResourceLocation playerSkin = new ResourceLocation(FMLClientHandler.instance().getClient().thePlayer.getSkinUrl(FMLClientHandler.instance().getClient().getSession().getUsername()));
Et voilà l’erreur console que j’ai, malgré qu’après test de l’URL elle fonctionne !
:::
août 08, 2014 10:04:02 PM net.minecraft.launchwrapper.LogWrapper log INFOS: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker août 08, 2014 10:04:02 PM net.minecraft.launchwrapper.LogWrapper log INFOS: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker août 08, 2014 10:04:02 PM net.minecraft.launchwrapper.LogWrapper log INFOS: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker 2014-08-08 22:04:02 [INFOS] [ForgeModLoader] Forge Mod Loader version 6.99.19.964 for Minecraft 1.6.4 loading 2014-08-08 22:04:02 [INFOS] [ForgeModLoader] Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_65, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jre7 2014-08-08 22:04:02 [INFOS] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation 2014-08-08 22:04:03 [INFOS] [ForgeModLoader] Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker 2014-08-08 22:04:03 [INFOS] [ForgeModLoader] Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker 2014-08-08 22:04:03 [INFOS] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker 2014-08-08 22:04:03 [INFOS] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker 2014-08-08 22:04:03 [INFOS] [ForgeModLoader] Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper 2014-08-08 22:04:03 [INFOS] [STDOUT] Loaded 40 rules from AccessTransformer config file fml_at.cfg 2014-08-08 22:04:03 [GRAVE] [ForgeModLoader] The binary patch set is missing. Either you are in a development environment, or things are not going to work! 2014-08-08 22:04:04 [GRAVE] [ForgeModLoader] The minecraft jar file:/C:/Users/Jean-Baptiste/.gradle/caches/minecraft/net/minecraftforge/forge/1.6.4-9.11.1.964/forge-1.6.4-9.11.1.964-mcp.jar!/net/minecraft/client/ClientBrandRetriever.class appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again! 2014-08-08 22:04:04 [GRAVE] [ForgeModLoader] FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem! 2014-08-08 22:04:04 [GRAVE] [ForgeModLoader] Technical information: ClientBrandRetriever was at jar:file:/C:/Users/Jean-Baptiste/.gradle/caches/minecraft/net/minecraftforge/forge/1.6.4-9.11.1.964/forge-1.6.4-9.11.1.964-mcp.jar!/net/minecraft/client/ClientBrandRetriever.class, there were 0 certificates for it 2014-08-08 22:04:04 [GRAVE] [ForgeModLoader] FML appears to be missing any signature data. This is not a good thing 2014-08-08 22:04:04 [INFOS] [ForgeModLoader] Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper 2014-08-08 22:04:04 [INFOS] [STDOUT] Loaded 110 rules from AccessTransformer config file forge_at.cfg 2014-08-08 22:04:04 [INFOS] [ForgeModLoader] Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker 2014-08-08 22:04:04 [INFOS] [ForgeModLoader] Launching wrapped minecraft {net.minecraft.client.main.Main} 2014-08-08 22:04:05 [INFOS] [Minecraft-Client] Setting user: TheAmateis 2014-08-08 22:04:07 [INFOS] [Minecraft-Client] LWJGL Version: 2.9.0 2014-08-08 22:04:07 [INFOS] [Minecraft-Client] Reloading ResourceManager: Default 2014-08-08 22:04:08 [INFOS] [MinecraftForge] Attempting early MinecraftForge initialization 2014-08-08 22:04:08 [INFOS] [STDOUT] MinecraftForge v9.11.1.964 Initialized 2014-08-08 22:04:08 [INFOS] [ForgeModLoader] MinecraftForge v9.11.1.964 Initialized 2014-08-08 22:04:08 [INFOS] [STDOUT] Replaced 112 ore recipies 2014-08-08 22:04:08 [INFOS] [MinecraftForge] Completed early MinecraftForge initialization 2014-08-08 22:04:08 [INFOS] [ForgeModLoader] Reading custom logging properties from C:\Users\Jean-Baptiste\Desktop\Modding\JAVA\ViruZ\Forge\eclipse\config\logging.properties 2014-08-08 22:04:08 [DÉSACTIVÉ] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL 2014-08-08 22:04:09 [INFOS] [ForgeModLoader] Searching C:\Users\Jean-Baptiste\Desktop\Modding\JAVA\ViruZ\Forge\eclipse\mods for mods 2014-08-08 22:04:13 [GRAVE] [ForgeModLoader] FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.Start. This is generally a severe programming error. There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW! 2014-08-08 22:04:13 [GRAVE] [ForgeModLoader] FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.FMLRenderAccessLibrary. This is generally a severe programming error. There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW! 2014-08-08 22:04:13 [INFOS] [ForgeModLoader] Forge Mod Loader has identified 7 mods to load 2014-08-08 22:04:13 [INFOS] [mcp] Activating mod mcp 2014-08-08 22:04:13 [INFOS] [FML] Activating mod FML 2014-08-08 22:04:13 [INFOS] [Forge] Activating mod Forge 2014-08-08 22:04:13 [INFOS] [FlansMod] Activating mod FlansMod 2014-08-08 22:04:13 [INFOS] [JoypadSplitscreenMod] Activating mod JoypadSplitscreenMod 2014-08-08 22:04:13 [INFOS] [AnimationAPI] Activating mod AnimationAPI 2014-08-08 22:04:13 [INFOS] [ViruZ] Activating mod ViruZ 2014-08-08 22:04:13 [AVERTISSEMENT] [Flan's Mod] Mod Flan's Mod is missing a pack.mcmeta file, things may not work well 2014-08-08 22:04:13 [AVERTISSEMENT] [Joypad / SplitScreen Mod] Mod Joypad / SplitScreen Mod is missing a pack.mcmeta file, things may not work well 2014-08-08 22:04:13 [AVERTISSEMENT] [AnimationAPI] Mod AnimationAPI is missing a pack.mcmeta file, things may not work well 2014-08-08 22:04:13 [AVERTISSEMENT] [ViruZ] Mod ViruZ is missing a pack.mcmeta file, things may not work well 2014-08-08 22:04:13 [INFOS] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Flan's Mod, FMLFileResourcePack:Joypad / SplitScreen Mod, FMLFileResourcePack:AnimationAPI, FMLFileResourcePack:ViruZ 2014-08-08 22:04:13 [INFOS] [ForgeModLoader] Registering Forge Packet Handler 2014-08-08 22:04:13 [INFOS] [ForgeModLoader] Succeeded registering Forge Packet Handler 2014-08-08 22:04:13 [AVERTISSEMENT] [ForgeModLoader] The mod id FlansMod attempted to register channels without specifying a packet handler 2014-08-08 22:04:13 [INFOS] [ForgeModLoader] Configured a dormant chunk cache size of 0 2014-08-08 22:04:13 [INFOS] [STDOUT] Flan's Mod : Preinitializing Flan's mod. 2014-08-08 22:04:13 [INFOS] [STDOUT] Flan's Mod : Preinitializing complete. 2014-08-08 22:04:13 [INFOS] [ForgeModLoader] preInit 2014-08-08 22:04:13 [INFOS] [ForgeModLoader] Setting shared profile to false 2014-08-08 22:04:13 [INFOS] [ForgeModLoader] Deleted category -Global- key SharedProfile 2014-08-08 22:04:13 [INFOS] [ForgeModLoader] updateKey updated -Global-:SharedProfile with false 2014-08-08 22:04:14 [INFOS] [ForgeModLoader] TheAmateis's JoyNo == -1 (). SharedProfile = false. GrabMouse = false. invertYAxis = false. ConfigVersion 0.1\. Game Sensitivity multiplier: 40\. Menu Sensitivity multiplier: 10 2014-08-08 22:04:14 [INFOS] [ForgeModLoader] Deleted category Joypad-TheAmateis key ConfigVersion 2014-08-08 22:04:14 [INFOS] [ForgeModLoader] updateKey updated Joypad-TheAmateis:ConfigVersion with 0.1 2014-08-08 22:04:14 [GRAVE] [ForgeModLoader] Found anonymous item of class viruz.zeamateis.backpack.ItemBackpackBase with ID 22100 owned by mod ViruZ, this item will NOT survive a 1.7 upgrade! 2014-08-08 22:04:15 [GRAVE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_1011_workingTable.png 2014-08-08 22:04:15 [GRAVE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_1008_campfireBurning.png 2014-08-08 22:04:15 [GRAVE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_1013_woodenCrossTomb.png 2014-08-08 22:04:15 [GRAVE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_1015_barricades.png 2014-08-08 22:04:15 [GRAVE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_1007_campfireIdle.png 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loading Flan's mod. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded textures and models. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded bullets. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded attachments. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded guns. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded grenades. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded parts. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded planes. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded vehicles. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded AA guns. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded mecha tools. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded mechas. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded tools. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded gun boxes. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded armour. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded classes. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded teams. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loaded recipes. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loading Flan's mod. 2014-08-08 22:04:16 [INFOS] [STDOUT] Flan's Mod : Loading complete. 2014-08-08 22:04:16 [INFOS] [ForgeModLoader] init 2014-08-08 22:04:16 [INFOS] [ForgeModLoader] Replaced mousehelper in Minecraft with JoypadMouseHelper 2014-08-08 22:04:17 [INFOS] [STDOUT] [Flan] Hooking complete. 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] postInit 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] Minecraft Joypad (Controller) Mod v1.6.4 by Ljubomir Simin & Andrew Hickey –- 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] Initializing Controllers 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] Found 3 controller(s) in total. 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] Found controller Toshiba Hotkey Driver (0) 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] It has 2 buttons. 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] It has 0 axes. 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] This controller does not meet the input requirements 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] –- 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] Found controller Toshiba Hotkey Driver (1) 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] It has 1 buttons. 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] It has 0 axes. 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] This controller does not meet the input requirements 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] –- 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] Found controller Toshiba Hotkey Driver (2) 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] It has 5 buttons. 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] It has 0 axes. 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] This controller does not meet the input requirements 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] –- 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] Found 0 valid controllers! 2014-08-08 22:04:17 [AVERTISSEMENT] [ForgeModLoader] No joypad set up for this session. 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] Creating VirtualKeyboard 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] Creating VirtualMouse 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] Creating McGuiHelper 2014-08-08 22:04:17 [INFOS] [ForgeModLoader] Forge Mod Loader has successfully loaded 7 mods 2014-08-08 22:04:17 [AVERTISSEMENT] [Flan's Mod] Mod Flan's Mod is missing a pack.mcmeta file, things may not work well 2014-08-08 22:04:17 [AVERTISSEMENT] [Joypad / SplitScreen Mod] Mod Joypad / SplitScreen Mod is missing a pack.mcmeta file, things may not work well 2014-08-08 22:04:17 [AVERTISSEMENT] [AnimationAPI] Mod AnimationAPI is missing a pack.mcmeta file, things may not work well 2014-08-08 22:04:17 [AVERTISSEMENT] [ViruZ] Mod ViruZ is missing a pack.mcmeta file, things may not work well 2014-08-08 22:04:17 [INFOS] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Flan's Mod, FMLFileResourcePack:Joypad / SplitScreen Mod, FMLFileResourcePack:AnimationAPI, FMLFileResourcePack:ViruZ 2014-08-08 22:04:17 [GRAVE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_1011_workingTable.png 2014-08-08 22:04:17 [GRAVE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_1008_campfireBurning.png 2014-08-08 22:04:17 [GRAVE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_1013_woodenCrossTomb.png 2014-08-08 22:04:17 [GRAVE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_1015_barricades.png 2014-08-08 22:04:17 [GRAVE] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/blocks/MISSING_ICON_TILE_1007_campfireIdle.png 2014-08-08 22:04:18 [INFOS] [STDOUT] 2014-08-08 22:04:18 [INFOS] [STDOUT] Starting up SoundSystem… 2014-08-08 22:04:18 [INFOS] [STDOUT] Initializing LWJGL OpenAL 2014-08-08 22:04:18 [INFOS] [STDOUT] (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) 2014-08-08 22:04:18 [INFOS] [STDOUT] OpenAL initialized. 2014-08-08 22:04:18 [INFOS] [STDOUT] 2014-08-08 22:04:18 [AVERTISSEMENT] [Minecraft-Client] Failed to load texture: http://skins.minecraft.net/MinecraftSkins/TheAmateis.png java.io.FileNotFoundException: http://skins.minecraft.net/MinecraftSkins/TheAmateis.png at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:53) at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:26) at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:69) at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:37) at viruz.zeamateis.gui.minecraft.GuiMainMenuViruZ.drawFakePlayer(GuiMainMenuViruZ.java:521) at viruz.zeamateis.gui.minecraft.GuiMainMenuViruZ.fakePlayer(GuiMainMenuViruZ.java:488) at viruz.zeamateis.gui.minecraft.GuiMainMenuViruZ.drawScreen(GuiMainMenuViruZ.java:607) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1036) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:946) at net.minecraft.client.Minecraft.run(Minecraft.java:838) at net.minecraft.client.main.Main.main(Main.java:101) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) at net.minecraft.launchwrapper.Launch.main(Launch.java:27) 2014-08-08 22:04:19 [GRAVE] [Minecraft-Client] Realms: Server not available! 2014-08-08 22:07:33 [INFOS] [Minecraft-Client] Stopping! 2014-08-08 22:07:33 [INFOS] [STDOUT] 2014-08-08 22:07:33 [INFOS] [STDOUT] SoundSystem shutting down… 2014-08-08 22:07:33 [INFOS] [STDOUT] Author: Paul Lamb, www.paulscode.com 2014-08-08 22:07:33 [INFOS] [STDOUT]
:::
Un petit Screen de ce qui marche pas:
-
Normal, tu essayes de lire directement un fichier distant.
Il faut download la texture.
Regardes le code du rendu de la tête de joueur. -
RenderPlayer ?
Je comptais me serveur du tutoriel pour les capes sur votre serveur mais il existe plus ?
-
net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer
En 1.7.10 il faut comme ça, mais en 1.6.4 c’est différent :ResourceLocation resourcelocation = AbstractClientPlayer.locationStevePng; if (p_152674_7_ != null) { Minecraft minecraft = Minecraft.getMinecraft(); Map map = minecraft.func_152342_ad().func_152788_a(p_152674_7_); if (map.containsKey(Type.SKIN)) { resourcelocation = minecraft.func_152342_ad().func_152792_a((MinecraftProfileTexture)map.get(Type.SKIN), Type.SKIN); } } this.bindTexture(resourcelocation);
Le tutoriel sur les capes a été supprimé car Mojang interdit de faire de capes customs, même si c’est pas pour être vendu.
-
Ah ok pour les capes et je vais tester cette fonction du coup on verra bien
J’arrive à afficher le steve mais pas le skin du joueur
Mes codes
ResourceLocation resourcelocation = AbstractClientPlayer.locationStevePng;
et
if (string != null && string.length() > 0) { resourcelocation = AbstractClientPlayer.getLocationSkull(string); AbstractClientPlayer.getDownloadImageSkin(resourcelocation, string); } this.mc.renderEngine.bindTexture(resourcelocation);
-
Tu peux envoyer tout le code ?
-
Voilà le code complet
:::
package viruz.zeamateis.gui.minecraft; import java.awt.Cursor; import java.awt.Desktop; import java.awt.Menu; import java.awt.Window; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.util.Calendar; import java.util.Date; import java.util.Map; import java.util.Random; import java.util.logging.Level; import java.util.logging.Logger; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiMultiplayer; import net.minecraft.client.gui.GuiOptions; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiSelectWorld; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.main.Main; import net.minecraft.client.model.ModelSkeletonHead; import net.minecraft.client.multiplayer.LanServerList; import net.minecraft.client.multiplayer.ServerData; import net.minecraft.client.multiplayer.ThreadLanServerFind; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.resources.I18n; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import org.lwjgl.util.glu.Project; import viruz.zeamateis.miscellaneous.Accentuation; import viruz.zeamateis.model.ModelFakePlayer; import viruz.zeamateis.model.mob.ModelCrawler; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GuiMainMenuViruZ extends GuiScreen { /** The RNG used by the Main Menu Screen. */ private static final Random rand = new Random(); /** Counts the number of screen updates. */ private float updateCounter; /** Timer used to rotate the panorama, increases every tick. */ private int panoramaTimer; /** * Texture allocated for the current viewport of the main menu's panorama background. */ private DynamicTexture viewportTexture; private boolean field_96141_q = true; private static boolean field_96140_r; private static boolean field_96139_s; private final Object field_104025_t = new Object(); private String field_92025_p; private String field_104024_v; private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("viruz:title/vzlogo.png"); /** An array of all the paths to the panorama pictures. */ private static final ResourceLocation[] titlePanoramaPaths = new ResourceLocation[] {new ResourceLocation("textures/gui/title/background/panorama_0.png"), new ResourceLocation("textures/gui/title/background/panorama_1.png"), new ResourceLocation("textures/gui/title/background/panorama_2.png"), new ResourceLocation("textures/gui/title/background/panorama_3.png"), new ResourceLocation("textures/gui/title/background/panorama_4.png"), new ResourceLocation("textures/gui/title/background/panorama_5.png")}; private ResourceLocation field_110351_G; private String text = readFile("http://viruz.fr/ViruZ/Launcher%201.6/News/ViruZ.txt"); private int textPosition; /** The 'Direct Connect' button was clicked */ private boolean directClicked; /** Instance of ServerData. */ private ServerData theServerData; private LanServerList localNetworkServerList; private ThreadLanServerFind localServerFindThread; private GuiButton buttonONOFF; private static ModelFakePlayer fakePlayer = new ModelFakePlayer(); private static final ResourceLocation playerSkin = new ResourceLocation(""); ResourceLocation resourcelocation = AbstractClientPlayer.locationStevePng; private String string; private float field_74209_t; private float field_74208_u; private float rotation; private float speedRotation = 0.5F; private static String newsComponent() { Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); String news = ""; if(calendar.get(2) + 1 == 8 && calendar.get(5) >= 1 && calendar.get(5) <= 31) { news = EnumChatFormatting.GOLD + "(New !)"; } return news; } private static String readFile(String url) { String text = ""; try { URL location = new URL(url); BufferedReader in = new BufferedReader(new InputStreamReader(location.openStream())); text = in.readLine(); } catch (Exception e) { System.out.println(e); } return text; } public GuiMainMenuViruZ() { this.updateCounter = rand.nextFloat(); } /** * Called from the main game loop to update the screen. */ public void updateScreen() { ++this.panoramaTimer; if (textPosition < 0 - mc.fontRenderer.getStringWidth(text)) { textPosition = width / 2 + 220; } textPosition -= 2; } /** * Returns true if this GUI should pause the game when it is displayed in single-player */ public boolean doesGuiPauseGame() { return false; } /** * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). */ protected void keyTyped(char par1, int par2) {} /** * Adds the buttons (and other controls) to the screen in question. */ public void initGui() { this.viewportTexture = new DynamicTexture(256, 256); this.field_110351_G = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture); Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); if (calendar.get(2) + 1 == 11 && calendar.get(5) == 9) { this.text = "Bon anniversaire, ez !"; } else if (calendar.get(2) + 1 == 6 && calendar.get(5) == 1) { this.text = "Bon anniversaire, Notch !"; } else if (calendar.get(2) + 1 == 12 && calendar.get(5) == 24) { this.text = "Joyeux No" + Accentuation.E_Tremat +"l !"; } else if (calendar.get(2) + 1 == 1 && calendar.get(5) == 1) { this.text = "Bonne ann" + Accentuation.E_Aigu + "e !"; } else if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31) { this.text = EnumChatFormatting.DARK_RED + "Viru" + EnumChatFormatting.DARK_GREEN + "Z " + EnumChatFormatting.WHITE + Accentuation.A_Grave + " 1 an !"; } else if (calendar.get(2) + 1 == 4 && calendar.get(5) == 5) { this.text = "Bon anniversaire, ZeAmateis !"; } else if (calendar.get(2) + 1 == 9 && calendar.get(5) == 3) { this.text = "Bon anniversaire, Tiarnan !"; } boolean flag = true; int i = this.height / 4 + 48; this.addViruZButtons(i, 24); } private void addViruZButtons(int par1, int par2) { Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); int i = this.height / 4 + 48; this.buttonList.add(new GuiButton(0, this.width / 2 - 100, i + 72 + 12, 98, 20, I18n.getString("menu.options"))); this.buttonList.add(new GuiButton(1, this.width / 2 - 100, i - 25 + 12, 150, 20, I18n.getString("Serveur PVE/PVP"))); /*if(this.mc.getSession().getUsername().equals("TheAmateis") || this.mc.getSession().getUsername().equals("IcyFlurry") || this.mc.getSession().getUsername().equals("hugolc")) {*/ this.buttonList.add(new GuiButton(2, this.width / 2 - 25, 110 + 12, 50, 20, I18n.getString("Solo"))); //} this.buttonList.add(new GuiButton(3, this.width / 2 + 2, i + 49 + 12, 98, 20, I18n.getString(EnumChatFormatting.DARK_RED + "Viru" + EnumChatFormatting.DARK_GREEN + "Z" + EnumChatFormatting.WHITE + ".fr"))); this.buttonList.add(new GuiButton(4, this.width / 2 - 100, i + 49 + 12, 98, 20, I18n.getString(EnumChatFormatting.DARK_RED + "Foru" + EnumChatFormatting.DARK_GREEN + "m"))); this.buttonList.add(new GuiButton(5, this.width / 2 - 100, i + 25 + 12, 98, 20, I18n.getString(EnumChatFormatting.WHITE + "Wiki" + EnumChatFormatting.DARK_GREEN + "Z"))); this.buttonList.add(new GuiButton(7, this.width / 2 + 2, i + 72 + 12, 98, 20, I18n.getString("menu.quit"))); this.buttonList.add(new GuiButton(9, this.width / 2 + 2, i + 25 + 12, 98, 20, I18n.getString("Cr" + Accentuation.E_Aigu + "dits " + newsComponent()))); } /** * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). */ protected void actionPerformed(GuiButton par1GuiButton) { if (par1GuiButton.id == 0) { this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings)); } if (par1GuiButton.id == 1) { /*if(this.mc.getSession().getUsername().equals("TheAmateis")) {*/ this.mc.displayGuiScreen(new GuiMultiplayer(this)); /* } else { this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, "pve.viruz.fr", 33200)); }*/ } if (par1GuiButton.id == 2) { this.mc.displayGuiScreen(new GuiSelectWorld(this)); } if (par1GuiButton.id == 3) { { Desktop desktop = null; java.net.URI url; try { url = new java.net.URI("http://viruz.fr"); if (Desktop.isDesktopSupported()) { desktop = Desktop.getDesktop(); desktop.browse(url); } } catch (Exception ex) { Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); } } } if (par1GuiButton.id == 4) { { Desktop desktop = null; java.net.URI url; try { url = new java.net.URI("http://viruz.fr/forum/"); if (Desktop.isDesktopSupported()) { desktop = Desktop.getDesktop(); desktop.browse(url); } } catch (Exception ex) { Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); } } } if (par1GuiButton.id == 5) { { Desktop desktop = null; java.net.URI url; try { url = new java.net.URI("http://viruz.fr/forum/viewforum.php?f=18"); if (Desktop.isDesktopSupported()) { desktop = Desktop.getDesktop(); desktop.browse(url); } } catch (Exception ex) { Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); } } } if (par1GuiButton.id == 7) { this.mc.shutdown(); } if (par1GuiButton.id == 9) { this.mc.displayGuiScreen(new GuiCredits(this)); } } /** * Draws the main menu panorama */ private void drawPanorama(int par1, int par2, float par3) { Tessellator tessellator = Tessellator.instance; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); byte b0 = 8; for (int k = 0; k < b0 * b0; ++k) { GL11.glPushMatrix(); float f1 = ((float)(k % b0) / (float)b0 - 0.5F) / 64.0F; float f2 = ((float)(k / b0) / (float)b0 - 0.5F) / 64.0F; float f3 = 0.0F; GL11.glTranslatef(f1, f2, f3); GL11.glRotatef(MathHelper.sin(((float)this.panoramaTimer + par3) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-((float)this.panoramaTimer + par3) * 0.1F, 0.0F, 1.0F, 0.0F); for (int l = 0; l < 6; ++l) { GL11.glPushMatrix(); if (l == 1) { GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); } if (l == 2) { GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } if (l == 3) { GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } if (l == 4) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); } if (l == 5) { GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); } this.mc.getTextureManager().bindTexture(titlePanoramaPaths[l]); tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(16777215, 255 / (k + 1)); float f4 = 0.0F; tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double)(0.0F + f4), (double)(0.0F + f4)); tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, (double)(1.0F - f4), (double)(0.0F + f4)); tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, (double)(1.0F - f4), (double)(1.0F - f4)); tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double)(0.0F + f4), (double)(1.0F - f4)); tessellator.draw(); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glColorMask(true, true, true, false); } tessellator.setTranslation(0.0D, 0.0D, 0.0D); GL11.glColorMask(true, true, true, true); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_DEPTH_TEST); } /** * Rotate and blurs the skybox view in the main menu */ private void rotateAndBlurSkybox(float par1) { this.mc.getTextureManager().bindTexture(this.field_110351_G); GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColorMask(true, true, true, false); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); byte b0 = 3; for (int i = 0; i < b0; ++i) { tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (float)(i + 1)); int j = this.width; int k = this.height; float f1 = (float)(i - b0 / 2) / 256.0F; tessellator.addVertexWithUV((double)j, (double)k, (double)this.zLevel, (double)(0.0F + f1), 0.0D); tessellator.addVertexWithUV((double)j, 0.0D, (double)this.zLevel, (double)(1.0F + f1), 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, (double)this.zLevel, (double)(1.0F + f1), 1.0D); tessellator.addVertexWithUV(0.0D, (double)k, (double)this.zLevel, (double)(0.0F + f1), 1.0D); } tessellator.draw(); GL11.glColorMask(true, true, true, true); } /** * Renders the skybox in the main menu */ private void renderSkybox(int par1, int par2, float par3) { GL11.glViewport(0, 0, 256, 256); this.drawPanorama(par1, par2, par3); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_TEXTURE_2D); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); float f1 = this.width > this.height ? 120.0F / (float)this.width : 120.0F / (float)this.height; float f2 = (float)this.height * f1 / 256.0F; float f3 = (float)this.width * f1 / 256.0F; 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); tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F); int k = this.width; int l = this.height; tessellator.addVertexWithUV(0.0D, (double)l, (double)this.zLevel, (double)(0.5F - f2), (double)(0.5F + f3)); tessellator.addVertexWithUV((double)k, (double)l, (double)this.zLevel, (double)(0.5F - f2), (double)(0.5F - f3)); tessellator.addVertexWithUV((double)k, 0.0D, (double)this.zLevel, (double)(0.5F + f2), (double)(0.5F - f3)); tessellator.addVertexWithUV(0.0D, 0.0D, (double)this.zLevel, (double)(0.5F + f2), (double)(0.5F + f3)); tessellator.draw(); } public void fakePlayer(int par1, int par2, float par3) { GL11.glPushMatrix(); GL11.glScalef(1.0F, 1.0F, 1.0F); GL11.glColor3f(1.0F, 1.0F, 1.0F); drawFakePlayer(par1, par2, par3); GL11.glPopMatrix(); } public void drawFakePlayer(int par0, int par1, float par2) { this.rotation += speedRotation; if(this.rotation > 360) { this.rotation = 0; } GL11.glPushMatrix(); GL11.glMatrixMode(5889); GL11.glPushMatrix(); GL11.glLoadIdentity(); ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); GL11.glViewport((scaledresolution.getScaledWidth() - 140) / 2 * scaledresolution.getScaleFactor(), (scaledresolution.getScaledHeight() - 140) / 2 * scaledresolution.getScaleFactor(), 512 * scaledresolution.getScaleFactor(), 300 * scaledresolution.getScaleFactor()); GL11.glTranslatef(-0.45F, -0.1F, 0.0F); GL11.glScalef(0.66F, 0.85F, 0.66F); Project.gluPerspective(90.599998F, 1.333333F, 9.0F, 180.0F); float f1 = 1.0F; GL11.glMatrixMode(5888); GL11.glLoadIdentity(); RenderHelper.enableStandardItemLighting(); GL11.glTranslatef(0.0F, -3.6F, -16.0F); GL11.glScalef(f1, f1, f1); float f2 = 5.0F; GL11.glScalef(4.0F, 4.0F, 4.0F); GL11.glRotatef(20.0F, -1.0F, 0.0F, 0.0F); if (string != null && string.length() > 0) { resourcelocation = AbstractClientPlayer.getLocationSkull(string); AbstractClientPlayer.getDownloadImageSkin(resourcelocation, string); } this.mc.renderEngine.bindTexture(resourcelocation); //this.mc.getTextureManager().bindTexture(playerSkin); GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); float f3 = this.field_74208_u + (this.field_74209_t - this.field_74208_u) * par1; GL11.glTranslatef((1.0F - f3) * 0.2F, (1.0F - f3) * 0.1F, (1.0F - f3) * 0.25F); GL11.glScalef(1.1F, 1.1F, 0.5F); GL11.glRotatef(this.rotation, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-(1.0F - f3) * 90.0F - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); /*float f4 = this.field_74212_q + (this.field_74213_p - this.field_74212_q) * par1 + 0.25F; float f5 = this.field_74212_q + (this.field_74213_p - this.field_74212_q) * par1 + 0.75F; f4 = (f4 - MathHelper.truncateDoubleToInt(f4)) * 1.6F - 0.3F; f5 = (f5 - MathHelper.truncateDoubleToInt(f5)) * 1.6F - 0.3F; if(f4 < 0.0F) { f4 = 0.0F; } if(f5 < 0.0F) { f5 = 0.0F; } if(f4 > 1.0F) { f4 = 1.0F; } if(f5 > 1.0F) { f5 = 1.0F; }*/ GL11.glEnable(32826); fakePlayer.render(0.0625F); GL11.glDisable(32826); RenderHelper.disableStandardItemLighting(); GL11.glMatrixMode(5889); GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); GL11.glPopMatrix(); GL11.glMatrixMode(5888); GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } /** * Draws the screen and all the components in it. */ public void drawScreen(int par1, int par2, float par3) { this.renderSkybox(par1, par2, par3); Tessellator tessellator = Tessellator.instance; short short1 = 274; int k = this.width / 2 - short1 / 2; byte b0 = 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); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if ((double)this.updateCounter < 1.0E-4D) { this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 99, 44); this.drawTexturedModalRect(k + 99, b0 + 0, 129, 0, 27, 44); this.drawTexturedModalRect(k + 99 + 26, b0 + 0, 126, 0, 3, 44); this.drawTexturedModalRect(k + 99 + 26 + 3, b0 + 0, 99, 0, 26, 44); this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44); } else { this.drawTexturedModalRect(k + 0, b0 + 0, 0, 0, 155, 44); this.drawTexturedModalRect(k + 155, b0 + 0, 0, 45, 155, 44); } //String SRV = "Vous avez lu les C.G.U " + EnumChatFormatting.RED + mc.getSession().getUsername() + EnumChatFormatting.WHITE + " ?"; String VZ = EnumChatFormatting.DARK_RED + "Viru" + EnumChatFormatting.DARK_GREEN + "Z"; String ZE = "ZeAmateis - Copyright Mojang AB"; this.drawString(this.fontRenderer, ZE, this.width - this.fontRenderer.getStringWidth(ZE) - 2, this.height - 10, 16777215); this.drawString(this.fontRenderer, VZ, 2, this.height - ( 1 * (this.fontRenderer.FONT_HEIGHT + 1)), 16777215); //this.drawString(this.fontRenderer, SRV, this.width - this.fontRenderer.getStringWidth(SRV) - 2, this.height - 22, 16777215); drawRect(0, 0, width, 12, 0x66000000); this.drawString(this.fontRenderer, text, this.textPosition, 2, 16777215); this.fakePlayer(par1, par2, par3); super.drawScreen(par1, par2, par3); } static Minecraft func_110348_a(GuiMainMenuViruZ par0GuiMainMenu) { return par0GuiMainMenu.mc; } static boolean func_110349_a(boolean par0) { field_96139_s = par0; return par0; } static Minecraft func_130018_c(GuiMainMenuViruZ par0GuiMainMenu) { return par0GuiMainMenu.mc; } static Minecraft func_130019_d(GuiMainMenuViruZ par0GuiMainMenu) { return par0GuiMainMenu.mc; } }
:::
-
Ta variable string est null, donc
if (string != null && string.length() > 0) { resourcelocation = AbstractClientPlayer.getLocationSkull(string); AbstractClientPlayer.getDownloadImageSkin(resourcelocation, string); }
n’est jamais exécuté.
string devrait valoir le pseudo du joueur.
-
Donc j’ai fait quelque chose comme ça:
ResourceLocation resourcelocation = AbstractClientPlayer.locationStevePng; private String string = FMLClientHandler.instance().getClient().getSession().getUsername();
et
if (string != null && string.length() > 0) { resourcelocation = AbstractClientPlayer.getLocationSkull(string); AbstractClientPlayer.getDownloadImageSkin(resourcelocation, string); }
Mais toujours le skin du petit mexicain, je pense que je me suis trompé quelque part
-
Je viens de vérifier, je ne vois pas pourquoi ça ne fonctionne pas.
Peut être le jeu n’a pas le temps de télécharger le skin. -
J’ai rien dans la console qui stipule qu’il télécharge le skin, je vais test un outprint
J’ai fait un outprint en dessous de
AbstractClientPlayer.getDownloadImageSkin(resourcelocation, string);
et le message ce répète en boucle donc il dois le télécharger non ?
Ah non j’ai fait le c** j’avais zapper le –username= dans les config de lancement ! ça marche !
-
Bravo x)