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

[refactor] reacharound placement feature #212

Merged

Conversation

lonefelidae16
Copy link
Contributor

@lonefelidae16 lonefelidae16 commented Jan 28, 2023

Refactor the feature of ReachAround placement. Shorter lines, more maintenability.

also resolve #211


Checklists

Compatibility

Block placement

  • Non-full block (updated)
    • Dirt Path
    • Soul Sand
    • Mud
    • Chests
    • Chain
    • Stonecutter
    • Grindstone
    • End Rod
    • Bed
    • Stairs, also on half position
    • Slabs, also on upside-down position
    • Fences
    • Walls
    • Cake
    • Amethyst Buds, Cluster
    • Sea Pickle
    • Flower Pot
    • Carpets
    • Trapdoors
    • Lectern
    • Enchanting Table

Changes

  • update ReachAroundPlacement.java

    • removed methods:
      • isNonFullBlock, use Entity#getSteppingPos instead
      • checkReachAroundAndExecute, due to injection method has changed
    • method access modifier has changed:
      • canReachAround: private -> public
    • in method canReachAround:
      • use Entity#isOnGround instead of checking the BlockState
      • use Entity#getSteppingPos instead of BlockPos#down to avoid collision error
  • update MinecraftClientMixin.java

    • modify MinecraftClient.crosshairTarget instead of executing the unique method checkReachAroundAndExecute

Refactor the feature of ReachAround placement.

* update `ReachAroundPlacement.java`
  - removed methods:
    + `isNonFullBlock`
    + `checkReachAroundAndExecute`
  - method access modifier has changed:
    + `canReachAround`: private -> public
  - in method `canReachAround`:
    + use `Entity#isOnGround` instead of checking the `BlockState`
    + use `Entity#getSteppingPos` instead of `BlockPos#down` to avoid collision error

* update `MinecraftClientMixin.java`
  - modify `crosshairTarget` instead of executing `checkReachAroundAndExecute`
* update `ReachAroundPlacement.java`
  - introduced new static method `getFacingSteppingBlockPos`
It seems to be necessary to check AIR or FLUIDS at stepping position in the `canReachAround` method.
@juancarloscp52 juancarloscp52 merged commit 40cae82 into juancarloscp52:1.19.3 Jan 29, 2023
@lonefelidae16 lonefelidae16 deleted the refactor/reacharound branch January 29, 2023 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatibility with Reacharound 1.1.1
2 participants