Skip to content
This repository was archived by the owner on Sep 2, 2021. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: TheBusyBiscuit/CS-CoreLib2
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.32.0
Choose a base ref
...
head repository: TheBusyBiscuit/CS-CoreLib2
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.32.1
Choose a head ref
  • 6 commits
  • 3 files changed
  • 3 contributors

Commits on Jun 12, 2021

  1. Verified

    This commit was signed with the committer’s verified signature.
    renovate-bot Mend Renovate
    Copy the full SHA
    246ea16 View commit details

Commits on Jun 13, 2021

  1. Merge pull request #192 from TheBusyBiscuit/renovate/nl.rutgerkok-blo…

    …cklocker-1.x
    
    Update dependency nl.rutgerkok:blocklocker to v1.10
    TheBusyBiscuit authored Jun 13, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f306125 View commit details

Commits on Jun 26, 2021

  1. Add a decompress method to BlockPosition and ChunkPosition. Improved …

    …the performance of the equality check
    md5sha256 committed Jun 26, 2021

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    md5sha256 Andrew Wong
    Copy the full SHA
    2da807b View commit details
  2. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    md5sha256 Andrew Wong
    Copy the full SHA
    7948023 View commit details

Commits on Jun 27, 2021

  1. Merge pull request #194 from md5sha256/feature/improved-block-api

    Improvements to the block utilities
    TheBusyBiscuit authored Jun 27, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    78a3c7a View commit details
  2. Bump version

    TheBusyBiscuit authored Jun 27, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f5360db View commit details
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
<groupId>com.github.thebusybiscuit</groupId>
<artifactId>cscorelib2</artifactId>

<version>0.32.0</version>
<version>0.32.1</version>

<packaging>jar</packaging>
<url>https://github.com/TheBusyBiscuit/CS-CoreLib2</url>
@@ -229,7 +229,7 @@
<dependency>
<groupId>nl.rutgerkok</groupId>
<artifactId>blocklocker</artifactId>
<version>1.9.2</version>
<version>1.10</version>
<scope>provided</scope>
</dependency>
<dependency>
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
* (Note, this is not accounting for things like object headers)
*
* @author Walshy
* @author md5sha256
*/
public final class BlockPosition {

@@ -175,6 +176,19 @@ public static long getAsLong(@NonNull Location loc) {
return getAsLong(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
}

/**
* Decompress a BlockPosition into an int[].
* @param position The compressed BlockPosition
* @return Returns a 3 length int[] where the x coordinate is at index 0, y at index 1 and z at index 2.
*
*/
public static int[] decompress(long position) {
int x = (int) (position >> 38);
int y = (int) (position & 0XFFF);
int z = (int) (position << 26 >> 38);
return new int[]{x, y, z};
}

/**
* {@inheritDoc}
*/
@@ -187,7 +201,7 @@ public boolean equals(Object o) {
return false;
}

return this.getWorld().getUID().equals(pos.getWorld().getUID()) && this.position == pos.position;
return this.position == pos.position && this.getWorld().getUID().equals(pos.getWorld().getUID());
}

return false;
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
*
* @author TheBusyBiscuit
* @author Walshy
* @author md5sha256
*
* @see BlockPosition
*
@@ -134,6 +135,18 @@ public static long getAsLong(int x, int z) {
return (((long) x) << 32) | (z & 0xFFFFFFFFL);
}

/**
* Decompress a ChunkPosition into an int[].
* @param position The compressed ChunkPosition
* @return Returns a 2 length int[] where the x coordinate is at index 0 and z at index 1.
*
*/
public static int[] decompress(long position) {
int x = (int) (position >> 32);
int z = (int) (position);
return new int[]{x, z};
}

/**
* {@inheritDoc}
*/
@@ -146,7 +159,7 @@ public boolean equals(Object o) {
return false;
}

return this.getWorld().getUID().equals(pos.getWorld().getUID()) && this.position == pos.position;
return this.position == pos.position && this.getWorld().getUID().equals(pos.getWorld().getUID());
}

return false;