Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DummyRecipe, minus the warnings #7

Closed
tseeker opened this issue Feb 10, 2018 · 2 comments
Closed

DummyRecipe, minus the warnings #7

tseeker opened this issue Feb 10, 2018 · 2 comments

Comments

@tseeker
Copy link

tseeker commented Feb 10, 2018

The following, while a bit dirty, gets rid of the warnings about resources from the wrong mod:

public DummyRecipe( final ResourceLocation location )
{
	try {
		@SuppressWarnings( "rawtypes" )
		final Class< IForgeRegistryEntry.Impl > cls = IForgeRegistryEntry.Impl.class;
		final Field fld = cls.getDeclaredField( "registryName" );
		fld.setAccessible( true );
		fld.set( this , location );
	} catch ( NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e ) {
		throw new RuntimeException( "Apparently, LexManos doesn't approve." , e );
	}
}
@Choonster
Copy link
Collaborator

That's a nice trick, but I think it's a bit too hackish. I try to keep this mod as a rough guide to the "best practises", so I don't want to mess with Forge's internals unless strictly necessary.

Thanks anyway.

@tseeker
Copy link
Author

tseeker commented Feb 11, 2018

Oh, yeah, definitely not good practice - but I was looking for a way to do it and saw the post in which you were considering switching the active ModContainer, so I thought I'd mention it. Thanks for your test mods, by the way, they're a great resource.

(I don't remember whether commenting will reopen the issue - that's not the goal, if so, I'm sorry)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants