Skip to content

add CoordinateOffset integration#453

Draft
BehrRiley wants to merge 4 commits into
DenizenScript:masterfrom
BehrRiley:bridge/coordinate-offset
Draft

add CoordinateOffset integration#453
BehrRiley wants to merge 4 commits into
DenizenScript:masterfrom
BehrRiley:bridge/coordinate-offset

Conversation

@BehrRiley

Copy link
Copy Markdown

Summary

this adds a new bridge for the CoordinateOffset plugin, allowing users to change a player's visual Y-axis offset; this enables creative impossible space black magic and cinematic rendering effects by detaching the client's rendered position from the server's physical position.

Prerequisites / Notes

this bridge is designed to utilize the Y-axis obfuscation logic proposed in CoordinateOffset PR #45; while this bridge will function correctly for X and Z offsets with the current plugin release, Y-axis manipulation will be inactive until the parent pull request #45 is merged

Changes

  • added CoordinateOffsetBridge to establish the hook into the CoordinateOffset API
  • added CoordinateOffsetPlayerProperties to addthe PlayerTag.coordinate_offset tag and mechanism pair
  • updated Depenizen.java to register the new bridge
  • added the minimal systemPath dependency to pom.xml

Testing

  • install CoordinateOffset
  • use new PlayerTag.coordinate_offset mechanism to test, like a visual shift:
    /ex adjust <player> coordinate_offset:0,-64,0
  • view the change in the player's F3 debug screen

Known Limitations

this implementation operates strictly at the packet layer for visual obfuscation; it does not synchronize server-side physics (eg, gravity/collision/walking/etc) with the obfuscated rendering. this feature is primarily intended for cinematic, creative, or flying/noclip use cases

import com.jtprince.coordinateoffset.api.CoordinateOffset;
import com.jtprince.coordinateoffset.adapter.OffsetPlayer;

public class CoordinateOffsetPlayerProperties implements Property {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is old way of registering properties, should use the new system, example here: https://github.com/DenizenScript/Depenizen/pull/418/changes


public void registerCoreBridges() {
// Yes it needs to be `new MyBridge()` not `MyBridge::new` - this is due to an error in the Java runtime.
registerBridge("CoordinateOffset", () -> new CoordinateOffsetBridge());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be sorted alphabetically.

Comment thread pom.xml Outdated
Comment on lines +406 to +412
<dependency>
<groupId>com.jtprince</groupId>
<artifactId>CoordinateOffset</artifactId>
<version>6.1.8-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/CoordinateOffset.jar</systemPath>
</dependency>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is technically after BigDoors alphabetically, it's also at the very end of the plugin list and should probably be moved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{project.basedir} can also be shortened to just {basedir}

import com.denizenscript.depenizen.bukkit.Bridge;
import com.denizenscript.depenizen.bukkit.properties.coordinateoffset.CoordinateOffsetPlayerProperties;

public class CoordinateOffsetBridge extends Bridge {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- refactor `CoordinateOffset` to use `PropertyExtension` and match the consistent new style
// Returns the player's current coordinate offset as a LocationTag (x, y, z).
// -->
PlayerTag.tagProcessor.registerTag(LocationTag.class, "coordinate_offset", (attribute, player) -> {
if (!player.isOnline()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use registerOnlineOnlyTag method instead

- remove manual `!player.isOnline()` check
- resort code
- add `CoordinateOffset` to `softdepend` list in `plugin.yml` and `Docs/BukkitPlugins.md`  alphabetrically
// Returns the player's current coordinate offset as a LocationTag (x, y, z).
// -->
PlayerTag.registerOnlineOnlyTag(LocationTag.class, "coordinate_offset", (attribute, player) -> {
OffsetPlayer offsetPlayer = CoordinateOffset.api().adaptPlayer(player.getPlayerEntity());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is used multiple times, you could create a separate static method to get it.

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.

3 participants