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 am wondering the best way to loop through a Item's isEffectiveOn() Block <set> in order to manually change the mining speed. Please help with your ideas? thanks.

 

I am currently doing....

if (isEffective(helditem, block)) {
		event.newSpeed = event.originalSpeed * 0.3f;
	}

private boolean isEffective(ItemStack helditem, Block block) {
	if (helditem.getItem() instanceof ItemTool) {
		Set tooltypes = helditem.getItem().getToolClasses(helditem);

		Iterator<String> i = tooltypes.iterator();

		while (i.hasNext()) {
			if (block.isToolEffective(i.next(), block.getDefaultState())) {
				return true;
			}
		}

	}
	return false;
}

  • Author

1. following tutorials it said to do this, and I have done this due to that my tool really is a tool and I take advantage of harvest levels, tool material etc. To me this seems simpler and more compatibly friendly

 

2. thanks fixed that

 

3. I had seen and fixed that but forgot to edit this post to show it

 

4. this is how I learnt to iterate through sets when learning java

  • Author

I just assumed using as much vanilla code as possible was best for comparability, so should I never extend ItemTool? and instead just extend Item?

  • Author

ohh I see sorry, misread what you meant :P

 

I have marked this one as solved but I am still having issues on the other topics you have been helping me with

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.