Posted June 6, 201510 yr Currently interopability between mods is very limited as requires each mod to include some API code before compiling. I think many mods would require only a small amount of information to be transfered between them to become compatible with each other. As an example, the butterflies in my ButterflyMania mod would only need to know if a particular block is a certain plant, whether it is currently considered food for butterflies and how tall the plant is. It would save a lot of overhead coding, if I just had a simple messaging system or bus that can request such information from a block or item. Similar to existing forge buses or the microsoft windows message system. With such interface it would become very easy for any modder to add compatibility to other mods. It would be like the oredictionary, but for block/item properties instead of recipes. The cost of adding and maintining this code to forge should be comparatively low (= 4-5 new classes below 30 LoC and very few lines of code added to Block.class and Item.class) and the gain for modders pretty high. Example Implementation for blocks (untested pseudo code): // MessageEvent.java: class MessageEvent { public final Class sender; // Mod Instance public final String message; public final World world; public final BlockPos pos; public final Object []params; } // MessageResponse.java: class MessageResponse { public final Class responder; // Mod Instance public final Object []params; } // in Block.class, which each mod can individually override public MessageResponse handleMessage(MessageEvent evt) { return null; } // e.g. in my Butterfly Entity: double foodblockheight = 0D; MessageEvent evt = new MessageEvent(ButterflyMania.instance, "foodBlockHeight", worldObj, pos, null); MessageResponse response = world.getBlockState(pos).getBlock().handleMessage(evt); if (response != null && response.params.length == 1 && response.params[0] instanceof Double) { foodblockheight = (Double)response.params[0]; } I can try to make a pull request if this idea has a chance of getting accepted.
June 6, 201510 yr https://www.google.com/?query=minecraft%20forge%20inter%20mod%20communication&gws_rd=ssl I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
June 6, 201510 yr Author Oh already available. Different than I imagined, but I can work with this. Thank you Forge Code God!
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.