Skip to content

Instantly share code, notes, and snippets.

@DavidRockin
Created January 16, 2022 20:01
Show Gist options
  • Save DavidRockin/c4fd6582f82983dce78a1ea834f39746 to your computer and use it in GitHub Desktop.
Save DavidRockin/c4fd6582f82983dce78a1ea834f39746 to your computer and use it in GitHub Desktop.
dave's sexy secet rotation branch magic
/**
* KEK rotation bitwise magic go BBRRRRRRRRRRRRRRRRRRRRRRRRR
*
* (c) Dave T kek
*/
__BRANCH__.engine.worldManager.entityManager.entityInteraction.rotateTileEntity = (e, id, cw) => {
let bits = (id >>> 29);
bits = (bits + 1) % 0b111;
id = ((bits << 29) | (id & 0x1FFF_FFFF)) >>> 0;
console.log(bits, id.toString(16));
e.setTileId(id);
return id;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment