Chance to get a custom mob drop using a custom sword

Started by RataDeOrdenador on Thu, 03/24/2016 - 12:14
Last seen on 15:32, 24. Mar 2016
Joined Mar 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Chance to get a custom mob drop using a custom sword
Thu, 03/24/2016 - 12:14

Sooooo yeah... that "Subject" is telling you guys the whole story here... >_>

I basically want all the mobs (Specially the hostile ones... they're going to have a REALLY BIG chance) to drop something.

EXAMPLE! (The mechanic is going to be the same... the item they drop are not. OBVIOUSLY. :V )

When I kill a friendly mob (cow,chicken,squid,etc..) with a "modded" sword, they're going to have a PRETTY SMALL chance to give you 1 DIRT BLOCK.  If I kill a hosile mob (Zombie,Creeper,Ghast) You have a somewhat decent chance to get between 1-3 DIRT BLOCK! A SMALL chance to get 1 IRON BLOCK,and A PRETTY SMALL chance to get a DIAMOND BLOCK!

Like I said,I don't want any mob to drops those things... seriously. Those are just EXAMPLES. I don't want to spoil too much of my mod, but yeah... <.<

 

btw...Where should I start? In the "Global Events",or the "Variable List"? :X

Last seen on 11:42, 20. Oct 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
Start with Event Handler
Thu, 03/24/2016 - 12:52

Start with Event Handler class

Last seen on 15:32, 24. Mar 2016
Joined Mar 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I should say that doesn't
Thu, 03/24/2016 - 14:26

I should say that doesn't help TOO much...

Just,where I write "all the code"? In the "Global Events"? Because it looks like it's the only place where you can write your "own custom code"

Ughh,I'm already getting so frustrated. D;

Last seen on 11:42, 20. Oct 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
RE:I should say that doesn't
Thu, 03/24/2016 - 14:59

@#2 You asked where to start.

But if you want , Event Handler is class where you handle some events that have forge build-in. Best example of event hadnlet is in MCreatot GUI-overlay. So make empty gui overlay and you have the start point.

There you put the event something like "OnPlayerKill" , and check for you sword. 

Last seen on 03:50, 12. Aug 2018
Joined Aug 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
RE:I should say that doesn't
Sat, 03/26/2016 - 16:10

@#2 You're asking a question that requires a little bit of intermediate coding to answer. In the main mCreator window with your "sword" item selected you need to click on "view source" on the top bar. This will show you the raw source code for the item. As Nuparu00 said, This source code needs an eventhandler with an "OnPlayerKill" event or something similar so that in the event that a mob is killed by this sword, it will drop your item. 

If you're still not quite getting what we're saying, you might want to go read some basic modding tutorials on the minecraft forums and come give it another try! :)