Jump to content

[1.7.10] How to add custom drops to a vanilla block? {Solved}


Kander16

Recommended Posts

Hi,

 

I am making a new item for a vanilla block (Ice block).

I have created Ice Shards, and you could get it when breaking Ice Blocks.

I don't think it's hard, but sometimes you just don't know how to get this to work. :P

 

Thanks for helping.

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

Link to comment
Share on other sites

Thanks,

 

I am trying to work at the HarvestDropsEvent in my "IceDrops" class file.

 

But I don't really now how to get the ice dropping my ice shards.

Cause I don't know how to set the quantity and the harvestlevel and things like that.

I hope I am working in the right direction. This is my code:

 

package com.chef.mod.event;

import java.util.Random;

import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;

import com.chef.mod.Chef;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class IceDrops {

          public static double rand;
          public Random r = new Random();

          @SubscribeEvent
          public void onBlockDestroyed(HarvestDropsEvent event) {
          if(event.block == Blocks.ice) {
          event.drops.add(new ItemStack (Chef.fuelIceShard));
          }
          }
                 
}[/Code]

Creator of the Master Chef Mod and many more to come.

 

If I helped you, please click the 'thank you' button.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

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