Jump to content

Jaideep Heer

Members
  • Posts

    13
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Jaideep Heer's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. ? he's using `forge-1.12.2-14.23.5.2768`
  2. I want to set up an IntelliJ project where I can manage multiple versions of my mod for different versions of forge. For this, I am currently using different modules in IntelliJ where each module is a sub-folder with the corresponding forge MDK extracted there for whichever forge version the module is supposed to run. However, my mods generally have some common code that is used in all versions independent of the forge version. This requires every IntelliJ module to share a common source folder where these common .java files reside. So far this approach is working fine for be but IntelliJ occasionally pops an error saying that different modules cannot have a common source folder, which I simply disregard. To assign an additional common source folder to every module, I modify the `build.gradle` file in every module by adding the following code to it, // Add common code to sourceSets sourceSets.each { it.java.srcDirs += '../common/java' it.resources.srcDirs += '../common/resources' } This, however, means that I must manually ensure that the common code compiles for every version of forge. It would be great if I can have some form of automation that at least warns me when some of my common code is incompatible with one of my forge versions in my modules. Since I am very new to Gradle and Minecraft codding in general, I would like to ask if there is an alternative method to achieve what I want or if ForgeGradle provides a feature to have such a multi-version setup. You can see my current setup here: ServerPropertiesLAN
  3. This is only the INFO log. You must post the DEBUG log. The DEBUG log is the `debug.log` file or one of the compressed `.gz` files in your `minecraft/logs/` folder. NOTE: The debug log is very large and I advise you to either use `gist.github.com` or attach the files here, to post it online.
  4. If you use a ClassTransformer to add an instruction that stores the returned port every time that function is called, it'll tell you the port that is being used currently. I use this method to make it send a custom port number thereby making that setting configurable.
  5. If you want to know what port the LAN server is hosted on, check out HttpUtil#getSuitableLanPort() because that is the class that is called while deciding a port for LAN. You can also use a ClassTransformer to inject your custom code that can either edit or just note down the port number returned by that function. Check out my ClassTransformer here .
  6. I am making a Discord integration mod and want to get the loading progress that is displayed during loading of the game. Can someone help me with this?
  7. The thread was open and the issue was unsolved for all these years. Also, I had the same issue ?
  8. I have found the solution to this problem. Check out my code:- /** * Uses hack to get a NashornScriptEngineFactory object. * @param nashornUsedClasses all classes detected in the NashornScriptEngineFactory class are added to this map where the key is the full name of the class. * @return the NashornScriptEngineFactory object */ private static ScriptEngineFactory getNashornScriptEngineFactory(Map < String, Class << ? >> nashornUsedClasses) { // First create a new ScriptEngineManager with null class loader to force it to load classes automatically. LOGGER.log(Level.INFO, "Attempting hack to get NashornScriptEngineFactory object."); ScriptEngineManager s = new ScriptEngineManager(null); LOGGER.log(Level.DEBUG, "New ScriptEngineManager with 'null' classloader created."); // DEBUG LOGGER.log(Level.DEBUG, "Loaded ScriptEngineFactory count = " + s.getEngineFactories().size()); LOGGER.log(Level.DEBUG, "getEngineByName(\"nashorn\") = " + s.getEngineByName("nashorn")); // Loop through list of ScriptEngineFactory to find NashornScriptEngineFactory for (ScriptEngineFactory f: s.getEngineFactories()) { // Check name if (f.getEngineName().endsWith("Nashorn")) { LOGGER.log(Level.INFO, "Found Nashorn ScriptEngineFactory."); LOGGER.log(Level.INFO, "Factory engine name = " + f.getEngineName()); LOGGER.log(Level.INFO, "Factory class = " + f.getClass()); // List of methods to check for obfuscation LOGGER.log(Level.INFO, "Factory Method list:-"); for (Method method: f.getClass().getDeclaredMethods()) { LOGGER.log(Level.INFO, method.getName()); for (Class << ? > c : method.getParameterTypes()) { LOGGER.log(Level.DEBUG, c.getName()); nashornUsedClasses.put(c.getName(), c); } } return f; } } return null; } The above function gives us a NashornScriptEngineFactory instance and populates the nashornUsedClasses map with the class objects detected in the NashornScriptEngineFactory class. We then use this code:- ScriptEngine engine; HashMap < String, Class < ? >> nashornUsedClasses = new HashMap < > (); ScriptEngineFactory nashornFactory = getNashornScriptEngineFactory(nashornUsedClasses); // Get the ClassFilter class object Class classFilter = nashornUsedClasses.get("jdk.nashorn.api.scripting.ClassFilter"); if (nashornFactory != null && classFilter != null) { // Use Dynamic Proxy to create an instance of ClassFilter(interface) Object classFilterInstance = Proxy.newProxyInstance(classFilter.getClassLoader(), new Class < ? > [] { classFilter }, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getName().equals("exposeToScripts")) { String className = (String) args[0]; return !(className.startsWith("java") || className.startsWith("jdmcmods") || className.startsWith("javax") || className.equals("net.minecraft.util.Session")); } else return false; } }); try { Method getScriptEngine = nashornFactory.getClass().getMethod("getScriptEngine", classFilter); engine = (ScriptEngine) getScriptEngine.invoke(nashornFactory, classFilterInstance); } catch (NoSuchMethodException e) { LOGGER.log(Level.ERROR, "Couldn't find getScriptEngine(ClassLoader) method in nashornFactory."); e.printStackTrace(); } catch (IllegalAccessException e) { LOGGER.log(Level.ERROR, "Couldn't access NashornScriptEngineFacroty's getScriptEngine(ClassFilter) function."); e.printStackTrace(); } catch (InvocationTargetException e) { LOGGER.log(Level.ERROR, "Couldn't create NashornScriptEngine from factory using custom ClassLoader."); e.printStackTrace(); } } At the end our 'engine' variable has the nashorn engine with our custom ClassFilter.
  9. Hi, Minecraft generates its worlds using a seed. This means that no matter how many times you regenerate a chunk, it will probably be very similar to what it originally was. Unless the dimension you're dealing with somehow doesn't use this seed or introduces some other randomness in its generation, I would say that it is better to try to create a new dimension.
  10. [/img][/url] If you look at the three images above, you can see that the different types of stairs are differentiated by three properties:- > facing > half > shape For connecting the stairs you'll probably mostly need to change the shape property. If you see the code in the BlockStairs class, you can use its getStairsShape() function to find the current shape of the stair. I haven't worked with blocks a lot so I can't really help any further. ?
  11. Hi, firstly there is a typo in the heading... you wrote Stars instead of stairs. Now, if you want to place the stairs in a certain rotation you can click on the appropriate side of the block,i.e. the block you are placing the stair on. If you want to rotate an already placed stair, break it... ?(cause I can't think of any way to rotate it without a modded item) Edit: I can't figure out whether you want to do it programmatically or not ?
  12. I have tried everything I could, however, I just can't get the @Config annotation to create an in-game GUI. In the mod list, there are no buttons, i.e no config button neither is there a enable/disable button for my mod. I tried to setup my workspace multiple times but nothing helped. I have also noticed that in the mod list my mod shows no information and there is a message saying 'no mcmod.info file was found'. Edit: Nevermind.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.