Skip to content
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

Merged
merged 1 commit into from
Mar 17, 2021
Merged

Conversation

yueh
Copy link
Member

@yueh yueh commented Mar 16, 2021

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

@yueh yueh added this to the 8.3.0-beta - 1.16.5 milestone Mar 16, 2021
@yueh yueh requested a review from shartte March 16, 2021 19:25
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) {
Copy link
Member

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

Copy link
Member Author

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
Copy link
Member

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

Copy link
Member Author

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.
Copy link
Member

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());
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@shartte shartte left a 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

@yueh
Copy link
Member Author

yueh commented Mar 17, 2021

There are a couple things overall missing.

  • The wrench does not swing when picking up a cable, however the network tool does.
  • Wrench does not break ME blocks currently.
  • Stuff I have already forgotten again.

@shartte shartte merged commit f3c90da into master Mar 17, 2021
@shartte shartte deleted the fix-4753 branch March 17, 2021 17:10
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants