Jump to content

[1.8] Plantdrops


Kaneka

Recommended Posts

I mean it should only drop the seed, the plant reproduces itself by placing itself on the next block. And if you harvest the Block, you should only get one seed, you should not reproduce it by getting more than 1 seed from harvesting the crop

Link to comment
Share on other sites

try something like this....

 

@SubscribeEvent
public void onHarvestEvent(HarvestDropsEvent event) {

	if (event.state.getBlock() == Blocks.wheat) {
		event.drops.clear();
		event.drops.add(new ItemStack(Items.wheat_seeds, 1, 1));
	}
}

 

haven't tested yet but should be close to what you want.

Link to comment
Share on other sites

If you have your own custom crop block, you do not need events.  Events is how you affect other mod's blocks (and in some cases, vanilla blocks).

 

If you have your own block all you have to do is override the function getDrops* and not call super() and then only add the items you want to add.

 

*Double check which function creates the seed stacks in BlockCrops, that's the one you want.

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

Thanks for the support, here the working code:

 

(can´t insert the code background, don´t know why...)

 

@Override

    public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)

    {

        java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune);

        ret.clear();

        ret.add(new ItemStack(this.getSeed(), 1, 0));

        return ret;

    }

Link to comment
Share on other sites

I only mean that when i click on the [insert code] button in the text editor of this forum, nothing changes...

 

yes, I was commenting on your code, can be tidied up a bit by doing that.

 

you can manually add code just by using the BB [ code] //your code here [ /code] without the space (I dont know how to escape BB code).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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