Jump to content

[1.12.2] How do i stop my block from dropping itself [Solved]


Recommended Posts

Posted (edited)

i have a block that a want to multiple items (which it does) but i cant figure out how to get it to stop dropping itself

 

Code

Spoiler

public class CowCarcassBlock extends CustomBlock {
      
    public CowCarcassBlock(String name) {
        super(Material.ROCK, name);
        setHardness(10f);
        setResistance(6000f);
        this.setHarvestLevel("pickaxe", 0);
        
        
    }
    
    @Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune) {
        return super.getItemDropped(state, rand, fortune);
    }
    
    @Override
    public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)

    {
        Random rand = new Random();
        
     int n = rand.nextInt(3) + 1;
     int a = rand.nextInt(3) + 1;
     int b = rand.nextInt(3) + 1;
     int c = rand.nextInt(3) + 1;

    super.getDrops(drops, world, pos, state, fortune);

    drops.add(new ItemStack(ItemInit.cowbelly, n));
    drops.add(new ItemStack(ItemInit.cowleg, a));
    drops.add(new ItemStack(ItemInit.cowshoulder, b));
    drops.add(new ItemStack(ItemInit.cowrump, c));
    
    

    }

    


    @SideOnly(Side.CLIENT)
    public BlockRenderLayer getBlockLayer()
    {
        return BlockRenderLayer.CUTOUT;
    }

    @Override
    public boolean isFullCube(IBlockState state)
    {
        return false;
    }
    
    @Override
    public boolean isOpaqueCube(IBlockState state) {
        return false;
    }
    

    @Override
    public CowCarcassBlock setCreativeTab(CreativeTabs tab) {
        super.setCreativeTab(ButcheryMod.BMCT);
        return this;
    }
    
    

}

 

 

Edited by Trhod177
Posted
3 hours ago, Trhod177 said:

 @Override     public Item getItemDropped(IBlockState state, Random rand, int fortune) {         return super.getItemDropped(state, rand, fortune);     }

Remove the other methods relating to drops and return Items.AIR from this method.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.