Jump to content

Multiple Item Drops From Block NOT WORKING [getDrops]


Harry12OK

Recommended Posts

I have recently started modding a week ago.I created a block , named it RUBY  BLOCK.The class in eclipse is also named same.I wanted to drop two items from it.First the drop itself, and second  a custom item named ORB.I wnated to make the ORB item rare

so i implemented the following method.

I made a custom class RubyDrop for my drops and returned a NonNullList .

 

public class RubyDrop  {

	RubyDrop h = new RubyDrop();
	Random random = new Random();

	public NonNullList<ItemStack> dropped() {
		NonNullList<ItemStack> drops = NonNullList.create();
		int z = random.nextInt(1) + 10;
		if (z < 9) {
			drops.add(new ItemStack(ModBlocks.RUBY_BLOCK));
		} else {

			drops.add(new ItemStack(ModBlocks.RUBY_BLOCK));
			drops.add(new ItemStack(ModItems.ORB));

		}
		return drops;
	}

}

 

and after that in my getDrops method of my RubyBlock from which i want to drop these things i implemented as following===>

@Override
	public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state,
			int fortune) {
		    RubyDrop k =  new RubyDrop();
			super.getDrops(k.dropped(), world, pos, state, fortune);
		}

 

I thought the thing would be right.But now the block is not dropping even anything.I dont know what's wrong.Anyone figure me out .

Link to comment
Share on other sites

What version of Minecraft?

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

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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