-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Substitution aliases severely broken #2825
Comments
Yeah, I've tried to use the substitution alias feature several times for some time and it has always been broken for different reasons. And yes, when I tried it last the issue was that the new block instance wasn't in the integer id map, if I remember correctly the issue happened when staging from global to the world registry, but I might be wrong. IMHO as nice as it would be to use this for the actual use cases, this feature might be too powerful and you might see many stupid modders fully replacing blocks when just using events would work. Maybe that's why it hasn't been given much attention, or maybe it's because it's so connected with the registries that any minor change there can break it. |
It worked well in 1.7, just had to register the textures because the method wasn't called. Depending on what your doing it isn't needed anyway. |
How would PopulateChunkEvent.Pre replace placed blocks inworld? |
Jabelar's code example I based mine on has a notice about needing to set the chunk as modified or it will replace all the blocks again every time the chunk is reloaded. I'm only replacing some instances of a generated block. It works with new chunks but I have never checked if it works in already generated chunks, just figured it was based on the notice. |
All of that hacks shouldnt be nessasary. |
I had written a test mod some time ago, if someone want's to go ahead and update it for 1.9, be my guest. |
I have a test mod here, originally written for this thread. You can see the FML log from a test run here. Issues I've noticed:
The replacement item seems to work without issue. |
sigh I'll have another pass at it. Substitution is a complete pain in the ass. |
@diesieben07 added labels [Bug] |
Any further progress? edit: my test mod from before: https://github.com/williewillus/remaptest/blob/master/src/main/java/williewillus/remaptest/RemapTest.java |
Any news? Got another person on irc needing this |
Excellent! |
I'm not really in need for this anymore, but good to hear it's fixed! |
Does this fix remapping as well? |
If not, add a test in a PR! I'll add it to the suite. I want as much coverage on uses of registry as possible in test cases. Fail needs to do a lot to it, so want broad test coverage before rewriting. |
Okay, from first glance seems like remapping things from a mod->vanilla is still not working. trying other remappings Edit: wait I derped, testing again |
Yeah, it doesn't work. My old test mod will probably reproduce this still. |
Don't want a test mod, they can't be properly automated. See the stuff in src/test and try and build a straight junit test case. |
Actually I don't think my use case is fully supported currently, reading through the code. I have "botania:prismarine", I want to retain the int ID<->RL mappings for it, but then I want the RL "botania:prismarine" to be aliased directly to "minecraft:prismarine". e.g. the actual object i get back when I do /give botania:prismarine is the real vanilla prismarine. The goal is to eventually remove my object and classes, leaving behind only such an alias mapping to migrate players to the vanilla block The current registry seems to assume that whatever new thing you're subbing in or remapping to is "fresh" and hasn't been registered before. |
maybe it isn't possible and Ishould just remove it lol |
@williewillus if it's not possible then it should maybe be made possible, it can see valid usecases for it, mods that backport newer vanilla stuff can migrate cleanly, mods that do major overhauls where alot of things are changed could use this to migrate cleanly. Adventure type mods that are used to make command block minigames would be one example |
I think this should work. But you're right, I think it expects the thing being "aliased to" to be new, which is annoying. I'll have to work out a test case. It was on my todo list. |
It appears that substitution aliases for blocks are broken quite substantially. Substituting any block for another one will result in various issues at runtime.
Example (code is executed in pre-init phase):
The issues I've noticed so far are as follows:
I haven't tracked down the part of the registry system where the issue would be fixed, but I think I found the underlying issue: Substitution does not modify
RegistryNamespaced.underlyingIntegerMap
properly or at all. I've traced this down by putting a breakpoint in the 2001 case forRenderGlobal.playAuxSFX
and stepping intoBlock.getBlockById
. All the way down the chain, I found that the underlying map returns-1
for the block which will then default to an air block. Hence, the game thinks the block is air and consequently does not save it on exit properly as well.I have only tried this on the latest Forge for 1.9 (12.16.1.1889), but I assume it was an issue before the new registry system as well since subsitution was not really affected by that.
Any input from other modders working with substitutions would be appreciated, maybe we'll be able to track down the bug in the substitution system.
The text was updated successfully, but these errors were encountered: