Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Jimmeh

Members
  • Joined

  • Last visited

Everything posted by Jimmeh

  1. Sure thing @matthew123. So I'm making a custom inventory screen and I'm wanting the text to be bigger because it's awfully small compared to everything else (as you'll see below). Here's the code for trying to scale the text: float x = pLeft; float y = pTop; pMatrixStack.scale(1.2f, 1.2f, 1.2f); minecraft.font.draw(pMatrixStack, new StringTextComponent("Amethyst Crystal"), x, y, HexColors.WHITE ); Here's the output without the MatrixStack#scale call: https://gyazo.com/ff4ab50a400feca55d72546b3e3b26f3 Now the display when calling scale(): https://gyazo.com/4638f6b1360a40bd19f78cab44926249 It's basically like a translation rather than a scale, so it's very confusing. I also tried making my own MatrixStack and applying the scale() call once at instantiation to avoid the compounding translation, but of course, that didn't scale anything - just translated it.
  2. Hey there. The default Minecraft font is too small for what I'm wanting to use it for, and trying to do: MatrixStack#scale before my: Minecraft.font#draw call doesn't work to actually scale the font itself (at least, it's not working for me). So my next idea was to simply take the default font and scale it by 1.5x in Photoshop. So now I have my minecraft_1-5x.png file in the directory "assets/mod-id/font/minecraft_1-5x.png". I'm creating the ResourceLocation and Style to use that like so: private static final ResourceLocation BIGGER_FONT = new ResourceLocation(TestMod.MOD_ID, "font/minecraft_1-5x.png"); private static final Style STYLE = Style.EMPTY.withFont(BIGGER_FONT); ... minecraft.font.draw(pMatrixStack, new StringTextComponent("Test String").withStyle(STYLE), x, y, HexColors.WHITE ); In game, this is now rendered as squares: https://gyazo.com/5e21ed018a839d9c928289776a2c0b17 I'm not really too sure what I'm doing wrong here; perhaps it's an incorrect folder structure. Thanks for any help!
  3. Brainstorming an idea here, not sure if it'll work. Is it possible to use a Mixin to have the Minecraft class extend Application from JavaFX? My thinking behind this is so that the Minecraft instance itself contains the Stage in which I can display the Scenes, perhaps allowing them to be displayed without forcing the game to be paused by opening separate windows. I've never used Mixins, so I'm unsure if this is possible or if it's even a good idea.
  4. Hi there. The past couple days I've been trying to add my own AbstractList object to my custom screen. It's been a real challenge to actually just get it to display right (of which, I still haven't managed to do). I thought I'd see if I could get JavaFX working within my project and glad to say I have. My question here is if it's possible to get the JavaFX scene to display within the game, rather than opening a separate window and pausing the game, like so (this is just a test Scene I grabbed from an old project): https://gyazo.com/d24922903975e107fdf626899bb4aabf If not, I'll give AbstractList another shot. Here's the relevant code: @Mod("testmod") public final class TestMod extends Application { private Stage stage; public TestMod() { try { final Method JFXInit = JFXPanel.class.getDeclaredMethod("initFx"); JFXInit.setAccessible(true); JFXInit.invoke(null); } catch (Exception e) { e.printStackTrace(); } Platform.runLater(() -> { stage = new Stage(); }); } @Override public void start(Stage primaryStage) throws Exception { this.stage = primaryStage; //I don't believe this code is ever even reached/fired } public void display() { Platform.runLater(() -> { try { Scene login = new Scene(FXMLLoader.load(getClass().getResource("/fxml/login.fxml")), 333, 316); this.stage.setScene(login); this.stage.show(); } catch (IOException e) { e.printStackTrace(); } }); } I'm using reflection to call the init() method because otherwise the ToolKit isn't be initialized for JavaFX (it was one of the most upvoted solutions on StackOverflow, so I went with it). Thanks for any help!
  5. Thank you @diesieben07!
  6. Sure thing. So in my custom screen class, here's all the logic related to printing to the screen: //Ensure screen always takes up the same amount of 'screen space' regardless of gui scale setting final float scale = 1.f / guiScale; pMatrixStack.scale(scale, scale, scale); //Create screen texture AbstractGui.blit(pMatrixStack, pos.x(), pos.y(), 0, start.x(), start.y(), dimensions.x(), dimensions.y(), textureSize.y(), textureSize.x()); //Then call the string render render(pMatrixStack, x, y); Here's the string render method: public void render(final MatrixStack matrixStack, final int x, final int y) { matrixStack.scale(2.f, 2.f, 2.f); AbstractGui.drawString(matrixStack, Minecraft.getInstance().font, "Test String", x, y, this.color); } All of this technically works, except for the string size being scaled at the end. My best guess is that perhaps I need to push or pop or flush or do something to the MatrixStack after the AbstractGui#blit call (of which I'll test right now --- unfortunately push and pop didn't solve the problem).
  7. Hey there. For my custom gui/screen, I'm wanting to print a String to the screen. I'm doing that like so: AbstractGui.drawString(matrixStack, Minecraft.getInstance().font, "Test String", x, y, this.color); It's working, but the text is incredibly small (this probably has to do with the game settings option for gui scale. Is there any way I can actually increase the font size or even just 'scale' the string? I've tried both the following right before making the AbstractGui#drawString call and neither worked: matrixStack.scale(2.f, 2.f, 2.f); GL13.glScalef(2.f, 2.f, 2.f); Any help would be appreciated! Thanks!
  8. Gotcha. For my knowledge, why is that? Is it for performance reasons? Also, I'm using GuiUtils to draw my texture to the screen. I happened to see that AbstractGui#blit seems to do the same thing. Is there a reason (or best practice) to use one over the other?
  9. Hi there. I'm making a custom Screen. The only YouTube tutorial that I've found that is doing something along the lines that I'm looking for is this one from years ago on 1.11 (I'm on 1.16.5), so I'm trying to adapt what I can. In the video he mentions that textures can't be larger than 256x256, and through my testing, that seems to be true. So I have 2 initial question based on that: 1) Is that still the current limitation? 2) If so, is there a way to 'scale' a texture after being loaded? The texture is just too small for what I'm wanting to use it for. I can't seem to find any updated tutorials on this, so any help is greatly appreciated! Thanks If context helps, I'm making my own inventory screen that will (ideally) mimic Elder Scrolls Online's inventory screen (the right side of this picture). The texture for the background is just too small when limited to 256 (of course, the client's GUI scale setting changes how much space this takes on screen, however, I'm hoping there's something I can do on my end that's more reliable than suggesting clients to use a certain scale setting). Also, just for my own curiosity, if the limit is still 256x256, how would something like the selection screen from Pixelmon be achieved? Would this be many 'smaller' textures placed right next to each other to give the illusion of one large texture?
  10. In case anyone comes across this problem or has issues with shadow too, I followed this template and everything now works.
  11. Hi there! This is a weird one. I have some basic debug in the constructor and pre-init method of my mod. If I use the Gradle task "runServer", I see the debug being printed (so meaning my mod is seemingly being loaded) in IntelliJ's console. If I, however, "shadowJar" and then drop that new jar file into a test server I have locally on my pc, my mod is never loaded; the debug never prints in the server console nor do I see any sort of output at all containing my mod's name. I'm very confused by this, but if I had to take a guess, I'm thinking there might be something I'm doing wrong with my build.gradle for shading. In case you happen to think that might actually be what the problem is, I'll include my build.gradle below: buildscript { repositories { // These repositories are only for Gradle plugins, put any other repositories in the repository block further below maven { url = 'https://maven.minecraftforge.net' } maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' } } plugins { id 'com.github.johnrengelman.shadow' version '7.1.2' //6.0.0 } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' group = "com.test" version = "${mc_version}-${mod_version}" archivesBaseName = "${mod_name}" java { toolchain.languageVersion = JavaLanguageVersion.of(8) } minecraft { mappings channel: 'snapshot', version: "${mappings_version}" // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') runs { client { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' mods { tesseract { source sourceSets.main } } } server { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' mods { tesseract { source sourceSets.main } } } data { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' args '--mod', 'tesseract', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') mods { tesseract { source sourceSets.main } } } } } mixin { add sourceSets.main, "Tesseract.refmap.json" config "Tesseract.mixins.json" } // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } repositories { maven { url 'https://jitpack.io' } } ext { rxjava = 'io.reactivex.rxjava3:rxjava:3.1.3' lombok = 'org.projectlombok:lombok:1.18.22' math = "org.spongepowered:math:2.0.1" config = 'com.electronwill.night-config:toml:3.6.5' caffeine = 'com.github.ben-manes.caffeine:caffeine:2.9.3' //3.0.5 when no longer on Java 8 mongo = 'org.mongodb:mongodb-driver-sync:4.4.1' } dependencies { minecraft "net.minecraftforge:forge:${forge_version}" // deobfProvided "mezz.jei:jei_${mc_version}:${jei_version}:api" // runtime "mezz.jei:jei_${mc_version}:${jei_version}" // compile "org.apache.httpcomponents:fluent-hc:${httpclient_version}" // Examples using mod jars from ./libs // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' implementation math implementation rxjava compileOnly lombok annotationProcessor lombok testCompileOnly lombok testAnnotationProcessor lombok implementation config implementation caffeine //implementation guice //implementation violet implementation mongo } /*shadowJar { archiveName("${mod_name}-${mc_version}-${mod_version}.jar") // Only shadow fluent-hc dependencies { include('org.apache.httpcomponents:fluent-hc:.*') include(config) include(mongo) include(rxjava) } // Relocate fluent-hc to prevent conflicts with other mods that include it relocate 'org.apache.http.client.fluent', "${shawdow_dir}.org.apache.http.client.fluent" relocate rxjava, "${shawdow_dir}.${rxjava}" classifier '' // Replace the default JAR }*/ /*reobf { shadowJar {} // Reobfuscate the shadowed JAR }*/ shadowJar.finalizedBy(reobf) The commented-out shadowJar parts at the bottom were my attempts at adapting Choonster's example that he provided in another forum post that was asking about obfuscating a shadowed jar. With that commendted out shadowJar task, I tried so many different 'combinations' and ideas, and frankly it never really made much of a difference in terms of my problem here. Thank you for any advice or help!
  12. Ah okay. Thank you!
  13. Hi there, I'm getting started in Forge after years in Spigot. In Spigot, there's a few simple methods like: plugin.getServer().getScheduler().runTaskLater(plugin, action, ticksDelay); plugin.getServer().getScheduler().runTaskTimer(plugin, action, ticksDelay, ticksRepeat); Each of these also have an asynchronous version as well. What would the Forge equivalent of these be? Thank you!
  14. Hmmm, okay! I'll have to look into TCP-level load balancer software. That very well may be the ideal solution! Again, thanks so much for your time and help!
  15. Okay, this is making more sense. And I was thinking on Player join because I suppose my mind is still in "proxy mode". haha. As in, that "Join Server" is the only server the player manually connects to, then all the other servers on the network, such as the game servers (perhaps each one representing a different region either in-game or in the world, such as US, EU, etc), are only accessible through the Join Server's transfer, so that this front, Join Server is the only one really exposed to the player. Not sure if that's the correct way to word it, but that's how it's worked in my mind the past few days I've been looking through proxies (even though I now understand this doesn't need to be a proxy).
  16. Ohhhh, okay. This actually sounds much more simple than what I was thinking. Lets say I have something like this: Join Server Game Server A Game Server B Game Server C The Join Server would have ServerSwitchy (of course, as well as the client). This server contains a collection of IPs for game servers that are currently active. So theoretically, the server-side could be listening on Forge's equivalent of a PlayerJoinEvent, have some logic to determine which game server to send them to, send the payload packet and the client-side ServerSwitchy gives them a choice to go or disconnect. Something like that?
  17. I just had a brief look through your repo. Although Forge syntax is still a bit foreign to me, this does generally make sense. Could you elaborate a bit on what a server-side counterpart to this could look like? Just to paint a picture of what I'm imagining, I'm ideally going to use something like Kubernetes to containerize servers and will have a deployment and server-management system to expand/contract the amount of servers based on current demand. So the server-side counterpart to a serverswitchy would theoretically be a proxy. Thinking out loud here, that would determine which of the servers to send the player to out of the ones that are currently available, then relay that IP to the serverswitchy mod, correct?
  18. Actually @diesieben07, I do have an initial question on this. When set up with a proxy, is the general 'flow' that the proxy would need to communicate with the server-side mod which would then communicate with the client-side serverswitchy-like mod? Edit: I think we just posted at the same time. haha. Your previous response answers this, I think.
  19. Brilliant! Thank you so much. I've worked with vanilla-based environments for many years and am now relatively new to Forge, so it was a bit daunting of how to actually accomplish this. I'll take a good look through this project. If I have questions, do you mind if I quote/tag you in the future on this thread to pick your brain a little bit?
  20. After briefly talking with another developer, he mentioned that "Forge syncs data before the login sequence is complete. Since you can’t reset the login phase you have no way to renegotiate that data." Apparently that's what 'breaks' the compatibility between Forge and various proxies. I asked if a Mixin could fix this behavior and he said it could in theory. So I wanted to update this thread and now ask someone has any thoughts on this / the approach I could take to accomplish this. Thanks again for any help given!
  21. Hi guys! I currently have a project that I've been developing in a 'vanilla' environment that I'm actually looking to transfer over to Forge, simply because of how much better the experience would be using Forge. Before starting on this Forge mod, I was planning ahead and was looking at options for proxies, of which I would greatly like to use Velocity. In their docs and by asking around their Discord, they don't support support versions of Forge of 1.13 or later because of changes in the "handshake protocol". But I also really don't want to use an unsupported version of Forge, such as 1.12.2, to be able to use a proxy. I was pointed in the direction of potentially making my own client-side mod to allow Forge to be compatible with an updated proxy, such as Velocity. When asking for a direction for achieving this, I was told to have a look at how the Forge server implements logins and that the discrepancy might be with how modified the handshake protocol is. This sounds like quite the challenge to me and I'm completely up for trying to accomplish it. So for the sake of planning ahead and having a rough idea of how I could accomplish that when the time comes to work on it, has anyone else had experience with trying to achieve this? I appreciate any help or direction offered! Thanks!
  22. I too am trying to learn how to make custom GUI's. Another person pointed me to this open source mod to use as reference. Using this class as a guide, I've now actually gotten a custom texture to print on screen close to how I want. https://github.com/Tfarcenim/ClassicBar/blob/1.14.x/src/main/java/tfar/classicbar/overlays/HealthBarRenderer.java I replaced his "drawTexturedModalRect()" with "GuiUtils.drawTexturedModalRect()". In his ModUtils class, he also has a tool to draw a String on screen, which I believe also exists in "GuiUtils" found in Forge and/or possibly in GlManager. I remember seeing it somewhere. Hope this helps!
  23. Oh. .________. Thanks for the help!
  24. Ah, my apologies. I'm normally good about that. I found a much more detailed error: Caused by: net.minecraft.util.ResourceLocationException: Non [a-z0-9/._-] character in path of location: arcana:textures/gui/testHealth.png However, I'm still at a loss here. From what I see there, I'm not using any "Non [a-z0-9/._-] character". I appreciate your help!
  25. Hey! I'm trying to learn how to make a custom GUI/HUD by trying to draw my own health bar. I'm attempting to load a ResourceLocation of the test texture but it keeps throwing an ExceptionInInitializerError: null. Here's my code: private static final ResourceLocation BAR = new ResourceLocation(Arcana.MOD_ID, "textures/gui/testHealth.png"); In my main class: public static final String MOD_ID = "arcana"; And finally my resources file structure is attached below. Any ideas or guidance would be appreciated! Thanks!

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.