Jump to content

[1.8.9] Custom Mob Drops Only With Specific Item?


Monstrous_Apple

Recommended Posts

@SubscribeEvent
public void addEntityDrop50(LivingDropsEvent event)
{
	if (event.getEntity() instanceof EntityCow)
	{
		if (event.getSource() != null && event.getSource().getEntity() instanceof EntityPlayer)
		{
			EntityPlayer player = ((EntityPlayer) event.getSource().getEntity());
			if (player != null)
			{
				ItemStack holding =  player.inventory.getStackInSlot(player.inventory.currentItem);
				if (holding != null && holding.getItem() instanceof MASoulHarvester)
				{
					ItemStack itemstack = new ItemStack(MASouls.CowSoul, 1);
					event.getDrops().add(new EntityItem(event.getEntity().worldObj, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, itemstack));
				}
			}
		}
	}
}

 

Jeeezz... Go back to Java tutorials. (I am serious dude, you won't get far with copy pasting from forums, and "that's how I learn" is no excuse).

  • Like 1

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

@SubscribeEvent
public void addEntityDrop50(LivingDropsEvent event)
{
	if (event.getEntity() instanceof EntityCow)
	{
		if (event.getSource() != null && event.getSource().getEntity() instanceof EntityPlayer)
		{
			EntityPlayer player = ((EntityPlayer) event.getSource().getEntity());
			if (player != null)
			{
				ItemStack holding =  player.inventory.getStackInSlot(player.inventory.currentItem);
				if (holding != null && holding.getItem() instanceof MASoulHarvester)
				{
					ItemStack itemstack = new ItemStack(MASouls.CowSoul, 1);
					event.getDrops().add(new EntityItem(event.getEntity().worldObj, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, itemstack));
				}
			}
		}
	}
}

 

Jeeezz... Go back to Java tutorials. (I am serious dude, you won't get far with copy pasting from forums, and "that's how I learn" is no excuse).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Well this seems to be working, so you think this is correct, yeah?

 

@SubscribeEvent
	public void addEntityDrop58(LivingDropsEvent event)
	{
		if (event.entity instanceof EntityCow)
		{
			if (event.source != null)
			{
				EntityPlayer player = ((EntityPlayer) event.source.getEntity());
				if (player != null)
				{
					ItemStack holding =  player.inventory.getStackInSlot(player.inventory.currentItem);
					if (holding != null && holding.getItem() instanceof MASoulHarvester)
					{
						ItemStack itemstack = new ItemStack(MASouls.CowSoul, 1);
						event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, itemstack));
					}
				}
			}
		}
	}

Link to comment
Share on other sites

Well this seems to be working, so you think this is correct, yeah?

 

@SubscribeEvent
	public void addEntityDrop58(LivingDropsEvent event)
	{
		if (event.entity instanceof EntityCow)
		{
			if (event.source != null)
			{
				EntityPlayer player = ((EntityPlayer) event.source.getEntity());
				if (player != null)
				{
					ItemStack holding =  player.inventory.getStackInSlot(player.inventory.currentItem);
					if (holding != null && holding.getItem() instanceof MASoulHarvester)
					{
						ItemStack itemstack = new ItemStack(MASouls.CowSoul, 1);
						event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, itemstack));
					}
				}
			}
		}
	}

Link to comment
Share on other sites

By the way why did you give me that code if it wasn't complete/ doesn't work?

It is complete and it is working (for 1.9+).

 

The fact that you don't have clue what you are doing is a different thing - if you can't figure out that event.getEntity() is the same as just event.entity then you simply don't know how Java/programming works and have no idea how to use your IDE.

 

Now before hating:

 

1. Read this sub-forum description.

 

2. Try to imagine situation where someone who has no idea how to work with physics goes to laboratory and starts asking questions on how to build an atomic bomb. Then imgaine that labs usually have documentation on everything that happens there. Then imagine that person asking about bomb, while not even LOOKING into those documents and getting crystal clear answers from those scientist in lab - still doesn't understand shit! Why? Because he is not a scientist. That is what is hapening here (hint, you are this guy, forum is lab and google/source is documentation). You can't expect to understand anything without actually learning it.

 

3. Seriously - go learn Java.

 

---------------------------------------------------------------------------

 

2nd post: Add this:

if (event.getSource() != null && event.getSource().getEntity() instanceof EntityPlayer)

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

By the way why did you give me that code if it wasn't complete/ doesn't work?

It is complete and it is working (for 1.9+).

 

The fact that you don't have clue what you are doing is a different thing - if you can't figure out that event.getEntity() is the same as just event.entity then you simply don't know how Java/programming works and have no idea how to use your IDE.

 

Now before hating:

 

1. Read this sub-forum description.

 

2. Try to imagine situation where someone who has no idea how to work with physics goes to laboratory and starts asking questions on how to build an atomic bomb. Then imgaine that labs usually have documentation on everything that happens there. Then imagine that person asking about bomb, while not even LOOKING into those documents and getting crystal clear answers from those scientist in lab - still doesn't understand shit! Why? Because he is not a scientist. That is what is hapening here (hint, you are this guy, forum is lab and google/source is documentation). You can't expect to understand anything without actually learning it.

 

3. Seriously - go learn Java.

 

---------------------------------------------------------------------------

 

2nd post: Add this:

if (event.getSource() != null && event.getSource().getEntity() instanceof EntityPlayer)

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

I understand what you're saying but not everyone has the time, I wish I did have the time to learn java, but unfortunately thanks to certain circumstances I can't do it, so instead with the little time I have I'm just doing it the faster way using tutorials on straight up modding which is working so far, honestly if I was able to learn Java I would.. anyway thanks for your help and thanks for being patient enough to stick around and help me. :)

Link to comment
Share on other sites

I understand what you're saying but not everyone has the time, I wish I did have the time to learn java, but unfortunately thanks to certain circumstances I can't do it, so instead with the little time I have I'm just doing it the faster way using tutorials on straight up modding which is working so far, honestly if I was able to learn Java I would.. anyway thanks for your help and thanks for being patient enough to stick around and help me. :)

Link to comment
Share on other sites

And make sure its not null

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

And make sure its not null

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

It's not rude, I have a personal reason as to why I can't, I did not come onto this forum and say "You all MUST help me" that is your choice if you want to use your own time to help me, I post for help and hope for help, I don't force you into helping me so if you don't want to, then don't. It's not like you was being forced into helping me anyway.

 

Edit: Everyone who tries and has tried to help me already knows I don't know much about Java so it's their choice to give up time to help another person. There's no forcing here.

Link to comment
Share on other sites

It's not rude, I have a personal reason as to why I can't, I did not come onto this forum and say "You all MUST help me" that is your choice if you want to use your own time to help me, I post for help and hope for help, I don't force you into helping me so if you don't want to, then don't. It's not like you was being forced into helping me anyway.

 

Edit: Everyone who tries and has tried to help me already knows I don't know much about Java so it's their choice to give up time to help another person. There's no forcing here.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements




  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Ligawin77 adalah bocoran slot rekomendasi gacor dari Ligawin77 yang bisa anda temukan di SLOT Ligawin77. Situs SLOT Ligawin77 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ligawin77 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ligawin77 merupakan SLOT Ligawin77 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ligawin77. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ligawin77 hari ini yang telah disediakan SLOT Ligawin77. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ligawin77 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ligawin77 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ligawin77 di link SLOT Ligawin77.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Asusslot adalah bocoran slot rekomendasi gacor dari Asusslot yang bisa anda temukan di SLOT Asusslot. Situs SLOT Asusslot hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Asusslot terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Asusslot merupakan SLOT Asusslot hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Asusslot. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Asusslot hari ini yang telah disediakan SLOT Asusslot. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Asusslot terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Asusslot terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Asusslot di link SLOT Asusslot.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Galeri555 adalah bocoran slot rekomendasi gacor dari Galeri555 yang bisa anda temukan di SLOT Galeri555. Situs SLOT Galeri555 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Galeri555 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Galeri555 merupakan SLOT Galeri555 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Galeri555. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Galeri555 hari ini yang telah disediakan SLOT Galeri555. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Galeri555 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Galeri555 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Galeri555 di link SLOT Galeri555.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Daftar Slot Kocok303 adalah bocoran slot rekomendasi gacor dari Kocok303 yang bisa anda temukan di SLOT Kocok303. Situs SLOT Kocok303 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Kocok303 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Kocok303 merupakan SLOT Kocok303 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Kocok303. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Kocok303 hari ini yang telah disediakan SLOT Kocok303. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Kocok303 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Kocok303 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Kocok303 di link SLOT Kocok303.
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 Slot Aster88 adalah bocoran slot rekomendasi gacor dari Aster88 yang bisa anda temukan di SLOT Aster88. Situs SLOT Aster88 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Aster88 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Aster88 merupakan SLOT Aster88 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Aster88. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Aster88 hari ini yang telah disediakan SLOT Aster88. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Aster88 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Aster88 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Aster88 di link SLOT Aster88.
  • Topics

×
×
  • Create New...

Important Information

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