Jump to content

[1.7.10] block drops not giving Lapis


Guest Abrynos

Recommended Posts

Guest Abrynos

I wrote an EventHandler for a BreakEvent. Here's the code. Somehow if i mine lapis ore, it drops ink sacks instead of lapis.

 

ArrayList<ItemStack> items = event.block.getDrops(world, x, y, z, meta, level);
EntityPlayer player = event.getPlayer();

for(ItemStack item : items){
		float f = 0.7F;
        	Random rand = new Random();
            double d0 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
            double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
            double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
            
            EntityItem entityitem = new EntityItem(world, (double) player.posX + d0, (double) player.posY + d1, (double) player.posZ + d2, item);
            entityitem.delayBeforeCanPickup = 10;
            world.spawnEntityInWorld(entityitem);
	}
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getBreakSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
        event.setCanceled(true);

 

i tried filling in this to the foreach loop, but it didn't do anything.

if(item.getItem().equals(Items.dye)){
			item.setItemDamage(4);
		}

Link to comment
Share on other sites

Guest Abrynos

This is only a part of my code. It works hand in hand with an enchantment and if the enchantment is there, it harvests all blocks of the same type connected to the one you broke with the pickaxe

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.