Jump to content

Random item.


Recommended Posts

Hey, i am making a loot block that on right click gets removed and spawns a random item with a probability.

 

 

 

 

this is what i have so far:

 

    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    	
    	
        EntityItem item = new EntityItem(worldIn, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ModTools.hardenedsharpstick, 1));
        worldIn.spawnEntity(item);
    	worldIn.destroyBlock(pos, false);
    	return true;
    }
}




i want to replace the modtools.hardenedsharpstick with a random item from a list, i tried to make a arraylist but i dont know how to make this for items.

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.