Posted October 22, 20178 yr Hi all, a user asked me, if I could port my mod back to 1.11.2 and 1.10.2. That's not the problem at all, I've more a problem to use conditionals to have an easy to use code afterwards without losing any functionality. As far as I know maven solves the topic conditionals by using different profiles which are used to include different files. So if I'm right let us take the following function: FMLCommonHandler.instance().getMinecraftServerInstance().getWorld( id ); //in 1.12.2 FMLCommonHandler.instance().getMinecraftServerInstance().worlds[ id ]; //in 1.11.2 FMLCommonHandler.instance().getMinecraftServerInstance().worldServers[ id ]; //in 1.10.2 Now I need to put them into a method like public static WorldServer getServer( int id ) and this one into separated files like: example.utils.getWorldServer.1-12-2.java; example.utils.getWorldServer.1-11-2.java; example.utils.getWorldServer.1-10-2.java; To use them I need to include the entire namespace with import example.utils.getWorldServer.*; The last step would be to create a xml file handling the profiles which java file should be included, where I got stucked. I mean shouldn't it be possible through gradle too? Like: if ( project.minecraft.version.equals("1.12.2") ) // include file 1-12-2.java else if ( project.minecraft.version.equals("1.11.2") ) // include file 1-11-2.java else if ( project.minecraft.version.equals("1.10.2") ) // include file 1-10-2.java If you have any other more sophisticated ideas to solve this topic I will appreciate it. Kind regards, Pixtar
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.