So, My girlfriend and I decided to follow along with the potato cannon example and then this happened:
We got around to wondering what else we could fit into a cannon to launch around the map, and set out looking for a more exciting projectile.
Yeah, these should do.
But then we realized cramming a melon into something designed for a potato created a certain scale problem, so we set out to create a new launcher, maybe some kind of shoulder-mounted apparatus.
There we go.
So a few tweaks to the source and then, Melons away!
But why stop there?
That was pretty fun for a few minutes, but then we started thinking, how can we make this even more exciting?
So upon careful examination of a watermelon, we noticed they're large enough to fit all kinds of things inside, like oh say, a bunch of dynamite. We call them Firemelons!
So we set up the ability to switch ammo types via a right click, made sure the plugin checks and consumes the type of ammo selected, and set up some timers for the newly explosive melons.
It was finally time to go out and test.
So there you go, we decided to make this post just to provide an example of learning by example. If you want to make plugins, follow along with the examples, and use your imagination.
A few notes if you actually want to play with this thing:
• Consumes ammo, which must be in an inventory slot, it won't recognize ammo in a hotbar slot. (might fix this later)
• Secondary fire, (Right Click) to change ammo type between Watermelons and Firemelons
• Completely untested in a multiplayer environment. Firemelons will explode and will damage players, buildings, environment, etc.
• Firemelons have 2 firing methods. We wanted melons to explode on impact if it would hit something close enough, so we used a raycast to determine this. In this case, the melon travels more like a rocket than in a trajectory. Otherwise the "potato launch" method is used. A possible in-game explanation for this is that the item "Dynamite" has the behind-the-scenes item name "tnt." Trinitrotoluene (TNT) was introduced as a safer alternative to Dynamite which is nitroglycerin based and extremely shock-sensitive. So assuming a firemelon could use either, TNT melons would not explode on impact whereas Dynamite melons would, so long as you found a way to stabilize it so it doesn't combust before it leaves the barrel of a cannon. Good luck with that. Don't try that at home without seeking professional assistance first, preferably from a licensed behavioral therapist.
• Use at your own risk
• Not recommended for use indoors.
• Aim away from face.
Extract or move the zip contents into your plugins folder. When done it should look like this: