Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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);
		}

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

does it also work with fortune?

i can only find .destroyBlockInWorldPartially

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.