Posted July 10, 20169 yr [/embed] Hello everyone, So here is my problem I'm trying to update my mod to 1.10.2 however I'm stuck with <block>.setSoundType which is protected. I searched on internet to find any answer and I found Reflection and Access Transformer. I don't want to create a new class for each block so what should I use ?I tried to use Access Transformers but I failed to and I didn't find any examples I don't know much things on reflection and I don't know if I can use it and keep this style : Block myBlock = new Block(...).setSoundType(...) Here is what I tried with Access transformers by following Forge Wiki (Which is for 1.7.10) I created a file named candycraftmod_at.cfg in project root folder I changed build.gradle and added these following lines at the end jar { manifest { attributes 'FMLAT': 'candycraftmod_at.cfg' } } I relaunched gradlew setupDecompWorkspace -> Not Working, still protected What do you suggest ? Thanks in advance (Sorry if my english is not perfect )
July 10, 20169 yr But if you do something like: public MyBlock(Material materialIn, String name) { super(materialIn, name); this.setSoundType(SoundType.CLOTH); } It works. Even been protected.
July 10, 20169 yr Author I agree with you, the problem is that I have a lot of blocks and I don't think It's a good Idea to add more classes just to have a constructor with one method in it. (And by the way having to use more parameters in this constructor)
July 10, 20169 yr Then just utilize your own blocks to handle that.(Single class would be sufficient) Simplest way would be override the setSoundType method with public, but it's definitely unclean way. I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
July 10, 20169 yr Author Yeah I considered doing that. However I don't know why setSoundType is the only protected method that doesn't have an access modifier in merged_at.cfg. Like in 1.7.10 or 1.8 (Don't remember which one exactly) setStepSound has been patched to public. So should I consider this is going to be patched or this is not a bug and I should do as you said ?
July 10, 20169 yr Author I'm going to do that. I think setSoundType was just forgotten from AT. Should I post an Issue on Github ?
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.