Posted August 24, 201510 yr 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); }
August 24, 201510 yr 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
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.