Help with Interact forge mod registered block / items to The Sponge Plugin

I need help with making Sponge Plugin which can interact with Installed Forge mod to the server like registered block / items!

For example: i want to make My Forge Mod Block++ Mod can be controlled by Sponge Plugin.

Here’s the example Function Map: Scan all Registered block / item from Installed forge mod in the server -> Find specified block / item from Installed forge mod in the server to be controlled -> if it exist, then Write any Command OR Code into it’s block / item from Installed forge mod in the server that wanted to be controlled.

IF THIS FUNCTION DOESN’T EXIST:
Please make these function, i would be really thankful if these function will be added as soon as possible into Sponge API OR any external plugin that can help me with this!

OR Just make Sponge API able to Interact with another java file in Eclipse (I Use eclipse to make Forge Mod and Plugin)

(Sorry for my bad grammar, i hope you understand)

I don’t quite understand what you want but forge already contains a registry for blocks, items and entitys. I have a working example for getting blocks out of the registry [here]

1 Like

i mean, I want to make Sponge Plugin works together with forge mod (whatever i can’t use the grammar perfectly, i will just explain something to you).

I Have a mod called “Money mod”

Money mod is a mod that adds money item, this Money mod include:

  • 1 Cents (Coin item)
  • 5 Cents (Coin item)
  • 1 Dollar (Cash item)
  • 5 Dollar (Cash item)
  • and bla bla bla…

i wanted to make the Money mod works together with Sponge plugin

I Have a plugin called “Money in item Plugin”

Money in item Plugin is a Plugin that change from Virtual Money Balance (in The bukkit plugin, there’s a mod called “Essentials” with many function like “Essentials Economy”-“Essentials Spawn”-“Essentials Group”-etc, and it’s [The Virtual Money Balance] Similar with a mod called “Essentials economy plugin”) into Money Item.

Money in item Plugin Require:

  • a Sponge Plugin that are similar Essentials Economy
  • a Sponge Plugin that will call another Sponge Plugin to be worked with Money In item Plugin
  • a Money Mod that i made for Changing from Virtual Money Balance into Coin Item, or Cash Item

and here’s the information:

  1. Money Mod (act like the thing that WOULD be changed from Virtual Money Balance)
  2. Money in item Plugin (act like the converter between Virtual Money Balance into Coin item or Cash item)
  3. a Sponge Plugin that are similar Essentials Economy (act like the thing that WILL be changed into Coin item or Cash item)
  4. a Sponge Plugin that WILL CALL another Sponge Plugin to be worked with Money In item Plugin (act like the commander from 1 Sponge Plugin to be worked with another Sponge Plugin)

This is what i wanted for, did you get it?

I got it. What your asking is pretty simple to accomplish. You basicly have to develop your plugin on the same workspace you make your forge mod on. But you have to make sure your plugin ONLY uses the spongeAPI. So you need to make an abstract layer between forge and sponge. That will work for the communication between your plugin and mod.

In order to accomplish this, I would look to the observer and singleton pattern. With the singleton on your mod, your plugin can bind itself to it. So if your mod makes a transactionevent, it can be passed to the plugin. Or if your plugin says, take 6$ from player. The plugin can notify the mod.

(Be aware i am not a fan of singleton, if you find another way to do it pls let me know :smile: )

Where i can learn with ‘observer’ and ‘singleton pattern’ thing? i can’t learn just from text, it’s too hard for me to understand OR Figure it out…

Design Patterns: Elements of Reusable Object-Oriented Software by the so called “Gang of Four” is pretty much the standard literature when it comes to software design patterns and definitely a must-read for anyone who is serious about programming.

There is an ebook version too and you might find a PDF if you know where to look. This website could also be interesting as it covers all examples from the book in Java.

2 Likes

Or for a simpler introduction most devs I know have a copy of head first design patterns on their desks.

1 Like