-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds a callback to change/override the pick block result. #907
base: 2001
Are you sure you want to change the base?
Conversation
Ignore all of the older commits, they were reverted for this pr |
* Sets random tick callback for this black. | ||
* | ||
* @param pickBlockCallback A callback using a block container and a random. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This javadoc is very wrong
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
public class PickBlockCallbackJS { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there no way to get a BlockContainerJS from here? Typically these callbacks provide one of those rather than the individual components that make it up such as BlockGetter, BlockState and BlockPos. Have a look at the other existing callbacks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, will do that.
@@ -31,6 +32,7 @@ | |||
import net.minecraft.world.entity.LivingEntity; | |||
import net.minecraft.world.entity.player.Player; | |||
import net.minecraft.world.item.ItemStack; | |||
import net.minecraft.world.item.Items; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like some random imports got added, you can run 'Optimise Imports' in Intellij to clean them up.
Description
Adds a callback to change the pick block result.
Example Script
Other details
I am not familiar on callbacks, so if there is a way to have 'return' in the callback return the string, instead of 'event.setPickBlockItem' that would be an improvement, but I'm not sure how to do that myself.