question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resource loader breaks vanilla behaviour

See original GitHub issue

Hello. By default, DefaultResourcePack#findInputStream returns null if resource was not found, however this mixin introduces a different behaviour that causes exception to be thrown. Could a PR be opened to implement a fix for that? (I can do that by myself if necessary) Thanks

See https://github.com/xxDark/BetterLoading/issues/2#issuecomment-964729312

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
xxDarkcommented, Nov 10, 2021

I haven’t been able to check the code yet, but catching the exception just to have another one be thrown in calling code seems quite wasteful. I think it’s fair to assume that this “behavior change” is not observable to normal outside code, so I think it would be better if you caught the exception yourself. I’m open to discussion though.

(On a side note, I’m curious to see if this particular optimization in your mod changes how long it takes to load a real-world modpack like AOF4 or not. I did similar experiments a while ago and these kinds of changes didn’t seem to help as far as performance was concerned.)

I will be able (to hopefully) confirm that it in fact does speed up performance if this issue gets either resolved in one way or another. I don’t want to catch all IOException’s due to overhead of backtrace capturing.

2reactions
warjortcommented, Nov 10, 2021

The fabric mixin looks wrong to me in 2 ways.

This broken behaviour seems to have been introduced by this requested refactoring https://github.com/FabricMC/fabric/pull/1564#discussion_r669205725

Originally the PR overwrote

   public InputStream open(ResourceType type, Identifier id) throws IOException

which does throw an IOException for not found.

But the refactoring made it overwrite

   protected InputStream findInputStream(ResourceType type, Identifier id)

Which returns null for not found and doesn’t even throw an IOException.

The overwritten method has changed the signature to

       @Nullable
	@Overwrite
	public InputStream findInputStream(ResourceType type, Identifier id) throws IOException {
		return fabric_mcJarPack.open(type, id);
	}

which makes the method public and adds a throws IOException.

The mixin delegates to a Jar(Directory)ResourcePack backed by the minecraft.jar which will throw a ResourceNotFoundException if the resource is missing.

A similar mistake was made for at least getInputStream.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crash · Issue #2 · xxDark/BetterLoading · GitHub
Your change fixed the crash, but now minecraft loads endlessly. I noticed that the mod still loads without the fabric-api, but unfortunately the...
Read more >
Paper Per World Configuration - PaperMC Documentation
This may break resource packs that rely on durability values when ... picks up items depends on the world's difficulty (vanilla behavior).
Read more >
Resource pack - Minecraft Wiki - Fandom
Behavior. Resource packs can be placed in the folder resourcepacks within the .minecraft folder. Each resource pack is either a sub-folder or a...
Read more >
How do I get behavior packs on Minecraft PE 0.16.0? - Arqade
... it will load in the world with the behaviour packs and resource packs ... bottom titled vanilla resource pack and Vanilla behavior...
Read more >
Fabric for Minecraft 1.19
Players should use Fabric Installer 0.11.0 and Fabric Loader 0.14.6 ... tags that Fabric mods can use, and register vanilla entries to them....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found