Jump to content

Recommended Posts

Posted

Title says it all. I recently added an information book to my mod that includes some tutorials which require images. But even at the lowest bearable resolution the image sizes are relatively large so i am just wondering if there is a way to use online images? Im guessing there isnt at least not without a lot of work but figured id ask anyway.

I am the author of Draconic Evolution

Posted

If the problem is that the files are large, then "online" doesn't exactly help since they still have to be downloaded for viewing and local files would be faster than online.  However, I understand that you may not want to bloat the size of the mod file when it is distributed, so guess downloading the asset later might make sense.

 

I can think of a couple ways of doing this.

 

1) Open separate browser.  I think easiest is just have your GUI open a browser fully -- you can have a warning (not everyone likes having a mod open a browser) and if user clicks a button they are taken to your site with nice online tutorial.  To open a browser you can use standard Java method:

	    Desktop d=Desktop.getDesktop();

    // Browse a URL, say google.com
    try {
		d.browse(new URI("your url goes here"));
	} catch (IOException e) {
		e.printStackTrace();
	} catch (URISyntaxException e) {
		e.printStackTrace();
	}

 

2) there are ways to actually embed browsers into GUI, but you'd have to look up tutorial for that.

 

3) you can download the files during the mod loading and then access them like regular assets or skins.  This requires file management though and frankly I think could run into trouble in terms of handling cases like where the computer running the mod isn't online, or if the downloads are taking a long time.  You'd probably need to manage threads, files and online downloading -- all of which is quite possible but requires intermediate level of Java programming.

 

Overall remember that Minecraft is just Java -- so anything that can be done in Java can be done in Minecraft.  You can probably look up "display online graphic in my Java program" and get information to help.

 

But I personally recommend that you either go ahead and just include the images as regular assets, or if not that then open a regular browser.  Everything else is going to take some serious coding.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Sure there is.

Minecraft skins are textures that come from an online server. I suggest you look at the code for that.

 

Thanks i didnt think of that.

 

If the problem is that the files are large, then "online" doesn't exactly help since they still have to be downloaded for viewing and local files would be faster than online.  However, I understand that you may not want to bloat the size of the mod file when it is distributed, so guess downloading the asset later might make sense.

 

I can think of a couple ways of doing this.

 

1) Open separate browser.  I think easiest is just have your GUI open a browser fully -- you can have a warning (not everyone likes having a mod open a browser) and if user clicks a button they are taken to your site with nice online tutorial.  To open a browser you can use standard Java method:

	    Desktop d=Desktop.getDesktop();

    // Browse a URL, say google.com
    try {
		d.browse(new URI("your url goes here"));
	} catch (IOException e) {
		e.printStackTrace();
	} catch (URISyntaxException e) {
		e.printStackTrace();
	}

 

2) there are ways to actually embed browsers into GUI, but you'd have to look up tutorial for that.

 

3) you can download the files during the mod loading and then access them like regular assets or skins.  This requires file management though and frankly I think could run into trouble in terms of handling cases like where the computer running the mod isn't online, or if the downloads are taking a long time.  You'd probably need to manage threads, files and online downloading -- all of which is quite possible but requires intermediate level of Java programming.

 

Overall remember that Minecraft is just Java -- so anything that can be done in Java can be done in Minecraft.  You can probably look up "display online graphic in my Java program" and get information to help.

 

But I personally recommend that you either go ahead and just include the images as regular assets, or if not that then open a regular browser.  Everything else is going to take some serious coding.

 

The issue  is mod file size. As it is now the tutorial images take up around 70% of my mod and thats just 2 tutorials. Ideally i would like to download them once on first startup but i haven't even started to learn java file systems although it would be a good way to learn. I think i will just look at all the options you and diesieben gave me and figure out which works best for my situation.

 

Thanks for the replys!

I am the author of Draconic Evolution

Posted

You can google "java download file" for a simple example, it's actually not that hard. The hardest part would be to get that file into the Minecraft resource system.

Already a step ahead of you.

 

This is what i have come up with keep in mind this code is just a proof of concept i will have to create a proper handler for it i just want to make sure there aren't any problems with it.

 

I am creating a new folder in the mods folder to store the images and i am getting the file path from the config file.

@Override
public void preInit(FMLPreInitializationEvent event) {

downloadLocation = event.getModConfigurationDirectory().getParentFile().getAbsolutePath() + "/mods/draconicevolution";
downloadLocation = downloadLocation.replaceAll("\\\\", "/");

File file = new File(downloadLocation);
if (!file.exists()) file.mkdir();

try {
	URL url = new URL("http://i.imgur.com/oHRx1yQ.jpg");
	String fileName = url.getFile();
	String destName = downloadLocation + fileName.substring(fileName.lastIndexOf("/"));

	InputStream is = url.openStream();
	OutputStream os = new FileOutputStream(destName);

	byte[] b = new byte[2048];
	int length;

	while ((length = is.read(b)) != -1) {
		os.write(b, 0, length);
	}

	is.close();
	os.close();
}catch (IOException e){
	LogHelper.info(e);
}

}

 

I am the author of Draconic Evolution

Posted

Thanks

I wanted to use the absolute path because i will need that for the resource location when i go to use it but that brings me to another question. Is there a way to create resource location from a file path? From what i can tell there isnt so how would i bind the image? im guessing GL11 has a function for that?

 

Edit: Trying to figure out how the texture system works. It looks like using the texture is going to be a bit tricky unless there is another way to do it that i havent found yet.

I am the author of Draconic Evolution

Posted

Ok so looks like i am going to have to learn how to use a mod container. Im sure i can figure can figure it out but do you know of any tutorials that could save some time? (I tried looking for one but all that came up were inventory containers)

I am the author of Draconic Evolution

Posted

Ok so im pretty sure i have it setup properly but i cant seem to get it to work. I assume i would use it like this new ResourceLocation("myRsPackName","imageName") but i cant figure out where to define "myRsPackName" there is getPackName() but that dosnt seem to work.

I am the author of Draconic Evolution

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • USA User You can get a 40 Off Temu Coupon code using the code ["aci789589"]. This Temu 40 Off code is specifically for new and existing customers both and can be redeemed to receive a 40% discount on your purchase. Our exclusive Temu Coupon code offers a flat 40 Off your purchase, plus an additional 30% discount on top of that. You can slash prices by up to 70% as a new Temu customer using code ["aci789589"]. Existing users can enjoy 40% off their next haul with this code. But that’s not all! With our Temu Coupon codes for 2025, you can get up to 90% discount on select items and clearance sales. Whether you’re a new customer or an existing shopper, our Temu codes provide extra discounts tailored just for you. Save up to 30% with these current Temu Coupons ["^"aci789589"^"] for June 2025. The latest Temu coupon codes at here. Free Temu codes 40 Off — ["aci789589"] Temu Coupon 40 Off — ["aci789589"] Temu Coupon 30% off — ["aci789589"] Temu Memorial Day Sale 75% off — ["aci789589"] Temu Coupon code today — ["aci789589"] Temu free gift code — ["^"aci789589"^"](Without inviting friends or family member) Temu Coupon code for Canada - 30% Off— ["aci789589"] Temu Coupon code Australia - 30% Off— ["aci789589"] Temu Coupon code New Zealand - 30% Off — ["aci789589"] Temu Coupon code Japan - 30% Off — ["aci789589"] Temu Coupon code Mexico - 30% Off — ["aci789589"] Temu Coupon code Chile - 30% Off — ["aci789589"] Temu Coupon code Peru - 30% Off — ["aci789589"] Temu Coupon code Colombia - 30% Off — ["aci789589"] Temu Coupon code Malaysia - 30% Off — ["aci789589"] Temu Coupon code Philippines - 30% Off — ["aci789589"] Temu Coupon code South Korea - 30% Off — ["aci789589"] Redeem Free Temu Coupon Code ["^"aci789589"^"] for first-time users Get a $100 discount on your Temu order with the promo code "aci789589". You can get a discount by clicking on the item to purchase and entering this Temu Coupon code 40 Off ["aci789589"]. Temu New User Coupon ["aci789589"]: Up To 75% OFF For First-Time Users Our Temu first-time user coupon codes are designed just for new customers, offering the biggest discounts and the best deals currently available on Temu. To maximize your savings, download the Temu app and apply our Temu new user coupon during checkout. Temu Coupon Codes For Existing Users ["aci789589"]: 40% Price Slash Have you been shopping on Temu for a while? Our Temu Coupon for existing customers is here to reward you for your continued support, offering incredible discounts on your favorite products. Temu Coupon For 40 Off ["aci789589"]: Get A Flat $100 Discount On Order Value Get ready to save big with our incredible Temu Coupon for 40 Off! Our amazing Temu 40 Off coupon code will give you a flat $100 discount on your order value, making your shopping experience even more rewarding. Temu Coupon Code For 40% Off ["aci789589"]: For Both New And Existing Customers Our incredible Temu Coupon code for 40% off is here to help you save big on your purchases. Whether you’re a new user or an existing customer, our 40% off code for Temu will give you an additional discount! Temu Coupon Bundle ["aci789589"]: Flat 40 Off + Up To 70% Discount Get ready for an unbelievable deal with our Temu Coupon bundle for 2025! Our Temu Coupon bundles will give you a flat $100 discount and an additional 40% off on top of it. Free Temu Coupons ["aci789589"]: Unlock Unlimited Savings! Get ready to unlock a world of savings with our free Temu Coupons! We’ve got you covered with a wide range of Temu Coupon code options that will help you maximize your shopping experience. 30% Off Temu Coupons, Promo Codes + 25% Cash Back ["aci789589"] Redeem Temu Coupon Code ["aci789589"] Temu Coupon 40 Off ["aci789589"] Temu Coupon 40 Off FOR EXISTING CUSTOMERS ["aci789589"] Temu Coupon 40 Off FIRST ORDER ["aci789589"] Temu Coupon 40 Off REDDIT ["aci789589"] Temu Coupon 40 Off FOR EXISTING CUSTOMERS REDDIT ["aci789589"] Temu 40 Off CODE ["aci789589"] Temu 100 OFF COUPON 2025 ["aci789589"] DOMINOS 100 RS OFF COUPON CODE ["aci789589"] WHAT IS A COUPON RATE ["aci789589"] Temu 40 Off FOR EXISTING CUSTOMERS ["aci789589"] Temu 40 Off FIRST ORDER ["aci789589"] Temu 40 Off FREE SHIPPING ["aci789589"]
    • Make a test with another Launcher like MultiMC or AT Launcher
    • Add crash-reports with sites like https://mclo.gs/ Looks like immersiverailroading and Optifine are conflicting - make a test without Optifine
    • And without create_more_automation?
  • Topics

×
×
  • Create New...

Important Information

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