Jump to content

Reflxction

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by Reflxction

  1. Thanks! It now renders much better. Here's the code in case anyone ran into the same problem: float imgRatio = (720F / 1280F); float containerRatio = ((float) sr.getScaledHeight() / (float) sr.getScaledWidth()); float finalWidth; float finalHeight; if (containerRatio > imgRatio) { finalHeight = sr.getScaledHeight(); finalWidth = (sr.getScaledHeight() * imgRatio); } else { finalHeight = (sr.getScaledWidth() * imgRatio); finalWidth = sr.getScaledWidth(); } Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation); finalWidth += 400F; // Extend the image display by 400 pixels Gui.drawModalRectWithCustomSizedTexture(0, 0, finalWidth, finalHeight, (int) finalWidth, (int) finalHeight, finalWidth, finalHeight);
  2. Hello. In the process of creating a GUI, I went on trying to give it a custom background. It works well except that, the image stretches itself to fit on the screen, which makes it look weird and impractical. I wonder if there was a way to make it fill the screen without being stretched. Pretty similar to how it appears here: . I'm mainly using Gui#drawModalRectWithCustomSizedTexture() to draw the resource (I tried using the BufferBuilder which roughly brought the same exact result). The image I would like to render has dimensions of 1280x720. I don't know if any other dimension would look better, so if you are aware of any more appropriate size then I'd love to know. Which looks on screen like that: (Blacked out parts are just hidden, however they are a part of the screen. The gradients are extra effects.). Here's the code I'm using: Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation); Gui.drawModalRectWithCustomSizedTexture(0, 0, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight()); I tried replacing all references to scaledResolution with the image's dimensions, which did not really change anything. Any idea on how to make it display normally without being stretched?
  3. Update: Apparently it was much simpler than I thought. @SubscribeEvent public void onRenderPlayer(RenderPlayerEvent.Pre event) { GlStateManager.enableBlendProfile(GlStateManager.Profile.TRANSPARENT_MODEL); } (Result below) Thanks for the help!
  4. Thanks for the help! I'll try when I get on my computer and report back.
  5. Hello. Over the past days I've been trying to find a way to render players to look transparent, just like when they're invisible with the see invisible friends scoreboard tag. I looked around the game code a lot and really couldn't find anything that seemed to be what I want. I probably didn't search enough, so can you possibly help me in my process or tell me where the best place to look at is? Regards ~Reflxction
  6. I was calling it in EntityJoinWorldEvent, where I assume the player wouldn't be null. Anyway, I did a few more googling and found out that what I was looking for is Minecraft.getSession().getProfile()#getId(), as this is what worked for me
  7. Hello. In the process of making a mod I have come across some weird behavior of the game. Anytime I attempt to call Minecraft.getMinecraft().player#getUUID() in singleplayer the game crashes with a NPE. The same thing happened with #getPersistentID(). Is there any reliable way to check if an entity is the player without causing crashes or something. I'm afraid comparing names may not 100% work, and since retrieving the UUID crashed the game, is there any better way to do so?
  8. Hm I see. Mainly trying to modify the client chat packet that is being sent when sending a chat message. I'm aware that this was added in future versions (I became after making the thread), the thing is I'm using 1.8.9 for my current mod (I know I should be on latest, but currently it's the most commonly used in pvp servers and such). I'll just stick with what I currently have, thanks
  9. That sounds rather useful, but my question was about events not packets themselves
  10. Hello, in my mod I have come to the need of using packet events. The only events I found were the CustomPacketEvent and its subclasses. I don't get the meaning of "custom" packet, does it mean that the packet was made by an external mod and not Forge, or made by Forge and not from Minecraft itself, or does it involve ANY packet? If not, are there any handy ways to modify a packet or cancel it? Thanks in advance.
  11. I think this was a mistake when I copied it, but it was closed with the quotations. I sometimes get those: Etag download for http://export.mcpbot.bspk.rs/versions.json failed with code 40 3 FAILURE: Build failed with an exception. * Where: Build file 'my workspace\build.gradle ' line: 39 * What went wrong: A problem occurred evaluating root project 'Impurity Capes'. > java.lang.NullPointerException (no error message) "failed with code 403" means forbidden access, but I could access this from my browser and even tried a VPN.
  12. Hello. Over the past days, I've been encountering issues with Gradle that Forge uses. Every Gradle command I execute seems to fail with the same error. I haven't modified my build.gradle or any Gradle file that the workspace contains. I'm getting the following errors (this one was on gradlew build): * Where: Build file 'my mod workspace\build.gradle ' line: 39 * What went wrong: A problem occurred evaluating root project 'my mod name'. > java.lang.NullPointerException (no error message) * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 37.669 secs It says line 39 in build.gradle, which is mappings = "stable_20 I'm using Forge 1.8.9 Before, everything was running completely fine and I didn't encounter any problems. One of the things I have done was update Java and IntelliJ IDEA. Could that be the cause? If so do I need to update other things like Gradle or will I have to downgrade Java? If not, got any idea or any way to fix that issue? Thanks in advanced.
  13. Yeah but doesn't the server modify the display name using a packet, and when the client receives it it renders based on it?
  14. Hello. Recently I've been working on a mod that formats player names. Everything is fine expect that the display name is done in the client then the server formats it. I was wondering if there was a way for the event#displayname in PlayerEvent.NameFormat to be the name after the server modifies it, or any other way to get the format name after being modified by the server. (by server I mean in multiplayer) Thanks in advance.
  15. No it's not, just like running a normal version from the official launcher (sorry for the bump, I forgot to check my forge account)
  16. You won't have to enter any of your Mojang info, he just meant that I shouldn't somewhere store their account details when they're playing, thats why I said its open sourced so people don't worry about that Yeah I read the EULA of MCP and Mojang, it only publishes classes that I have written myself.
  17. I'm aware of that, but since my client will be open sourced, I think this will remove those worries
  18. Hm, alright, thanks. Why not? It's not a hacked client, an improvements one, nor is it breaking Minecraft's EULA or distributing its code.
  19. Hello. Lately, I've been interested in creating a new Minecraft client. It has been all good, until I realized I'm in a high need for lots of Forge's features (mod loaders, events, registries, utils, etc.). I was wondering if it's possible to integrate Forge to MCP. I have tried to create a new Gradle project, then copied all the files from a Forge mod environment, then copied Minecraft's code and MinecraftForge's code into the src directory, then kept getting an error on :makeStart. If anyone could help me integrate Forge, I'll be extremely thankful. P.S: I hope what I'm asking for isn't illegal or something (conflicting with the license of Forge).
  20. I'm not sure, I think in initGui method, but if it doesn't work there try in different methods. And try Mouse.setCatched(false), if it doesn't work try true idk
  21. Try Mouse#setCatched(), it could work but I am not sure
  22. Hello,slately I've been running into a really annoying problem. I'm making a mod and trying to use a dependency from jitpack, but it's failing to build, and when it builds, I end up crashing with a NoClassDefFoundError. The dependency I'm trying to use is https://github.com/KevinPriv/HypixelApi4J, and in the coding area it works perfectly fine, but when I build, there are two cases: 1, if I add jar { from configurations.embed.collect { it.isDirectory() ? it : zipTree(it) } } then it wouldn't build and give me a "java.util.zip.ZipException: duplicate entry: me/kbrewster/exceptions/InvalidSessionException.class", which is a class from the library I'm trying to use. 2, if I don't add the thing above, it would build successfully but would end up crashing with a NoClassDefFoundError. Here's my build.gradle: https://www.hastebin.com/egimacuqim.cs I've never used Gradle before as I'm used to maven, so don't judge me if I did any stupid mistake. Thanks
  23. Ah thanks, I'm used to Bukkit forums, which has something like a thread label, but all good now thanks
  24. Oh thanks mate, I really didn't think of it like this. I've delayed it by 1 tick and now it works perfectly, thanks man I'm new to this forums thingy, how do I mark the thread as solved?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.