-
Notifications
You must be signed in to change notification settings - Fork 651
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
Fixes #4753: Use the vanilla helper for SUCCESS or CONSUME #5072
Conversation
This makes now use of the vanilla helper to return `SUCCESS` or `CONSUME` depending on the side. Also some general cleanup like unused imports, missing file headers, etc
@@ -47,11 +46,11 @@ public ActionResultType onActivated(final World w, final BlockPos pos, final Pla | |||
final @Nullable ItemStack heldItem, final BlockRayTraceResult hit) { | |||
final GrinderTileEntity tg = this.getTileEntity(w, pos); | |||
if (tg != null && !InteractionUtil.isInAlternateUseMode(p)) { | |||
if (p instanceof ServerPlayerEntity) { |
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.
is p nullable and this elides a null-check? I don't remember
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.
InteractionUtil.isInAlternateUseMode(p)
guards against it by throwing a NPE before it even reaches the instanceof
.
But otherwise no idea. Looks like an outlier. There is also no special handler here for fakeplayers, that is just for the crank.
Otherwise anything else follows the pattern with getTile && !isRemote
@@ -333,6 +333,8 @@ public void registerCraftingSimulation(final World world, final CraftingJob craf | |||
|
|||
/** | |||
* Simulates the current crafting requests before they user can submit them to be processed. | |||
* | |||
* @param world |
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.
I think we're just turning in circles .I remove them, you add them back :-D
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.
Rebase with conflicts ftw.
if (block instanceof AEBaseBlock) { | ||
if (Platform.isClient()) { | ||
if (w.isRemote()) { | ||
// TODO 1.10-R - if we return FAIL on client, action will not be sent to server. |
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.
Should we just remove this
context.getPlayer().swingArm(context.getHand()); | ||
return !context.getWorld().isRemote ? ActionResultType.SUCCESS : ActionResultType.FAIL; | ||
if (aeBlock.rotateAroundFaceAxis(w, pos, context.getFace())) { | ||
p.swingArm(context.getHand()); |
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 seems hyper-fishy.... Is this because we're in onitemusefirst?
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.
No idea and I do not really want to touch it currently.
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.
LGTM except for swingHand in the wrench code, no idea why that is there. It may behave differently for onItemUseFirst
There are a couple things overall missing.
|
This makes now use of the vanilla helper to return
SUCCESS
orCONSUME
depending on the side.Also some general cleanup like unused imports, missing file headers, etc