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

Issues to resolve (and make the addon use Stable APIs) #5

Closed
Assassin1065 opened this issue Sep 7, 2024 · 13 comments
Closed

Issues to resolve (and make the addon use Stable APIs) #5

Assassin1065 opened this issue Sep 7, 2024 · 13 comments
Labels
enhancement New feature or request

Comments

@Assassin1065
Copy link
Contributor

Assassin1065 commented Sep 7, 2024

  1. edit Manifest.json and use :
    { "module_name": "@minecraft/server-ui", "version": "1.1.0" }, { "module_name": "@minecraft/server", "version": "1.13.0" }
  2. Add the component "minecraft:hand_equipped": true, to the debug stick item.
  3. Edit the displayBlockInfo function.
function displayBlockInfo(player, block) {
    let info = "§l§b" + block.typeId + "§r";
    info += "\n§4" + block.x + " §a" + block.y + " §9" + block.z;
    info += "\n§7matter state§8: §e";
    if (block.isLiquid) info += "liquid";
    else if (block.isAir) info += "gas";
    else info += "solid";
    info += "\n§7hard block§8: " + (block.isSolid ? "§ayes" : "§cno");
    // Retrieve and display the block states/properties
    Object.entries(block.permutation.getAllStates()).forEach(([k, v]) => {
        info += "\n§o§7" + k + "§r§8: ";
        if (typeof v == "string") info += "§e";
        if (typeof v == "number") info += "§3";
        if (typeof v == "boolean") info += "§6";
        info += v;
    });
    // Check if the block type can be waterlogged and display the status
    if (block.type.canBeWaterlogged) info += "\n§o§7waterlogged§r§8: §6" + block.isWaterlogged;
    // Display block tags if available
    if (block.tags) {
        block.tags.forEach(tag => info += "\n§d#" + tag);
    }
    // Show the message to the player
    message(info, player);
}```
@vytdev
Copy link
Owner

vytdev commented Sep 7, 2024

Ohh interesting... I'll check it.

@Assassin1065
Copy link
Contributor Author

Turns out server-ui isnt needed.

@vytdev vytdev added enhancement New feature or request wontfix This will not be worked on labels Sep 7, 2024
@vytdev
Copy link
Owner

vytdev commented Sep 7, 2024

hey @Assassin1065

thanks a bunch for all the work you put into the PRs and trying to get the addon working with the stable API. seriously, it means a lot, and I really appreciate the effort…

but, after going through the changes and running the tests, I noticed some key stuff like:

  • BlockType.canBeWaterlogged
  • Block.isWaterlogged
  • Block.setWaterlogged()
  • Block.isSolid
  • Block.getRedstonePower()

aren't available yet in the stable API version you set (1.13.0). these are pretty important for the addon, and without them, some core features won’t work right :/

also, while the code looks good overall, the CI tests ended up failing 'cause of these missing features. additionally, we don't need @minecraft/server-ui for the debug stick to work

so yeah, with that in mind, I’m gonna have to close the PRs and mark the issue as "wontfix" for now... but once those features are supported in the stable API, we can totally revisit it

thanks again for all your contributions! really hope to see more from you down the road :)

@vytdev
Copy link
Owner

vytdev commented Sep 7, 2024

just let me know if there's anything we can improve! i'm also waiting for the game's API to be fully stable, but there are still a few things the addon needs to work around for now

@Assassin1065
Copy link
Contributor Author

Gotcha. Those will still work with beta apis. I prefer working without beta apis so I overlooked these.

I still think you should push some sort of update to this.

@Assassin1065
Copy link
Contributor Author

Also adding the "minecraft:hand_equipped" component to the debug stick item will make it render just like a tool when held in hand, just like it does in java, and it would match the vanilla stick.

@vytdev
Copy link
Owner

vytdev commented Sep 7, 2024

Also adding the "minecraft:hand_equipped" component to the debug stick item will make it render just like a tool when held in hand, just like it does in java, and it would match the vanilla stick.

ohh, sorry I didn’t notice that I closed that separate PR. i will go ahead and reopen it and do some checks

@vytdev
Copy link
Owner

vytdev commented Sep 7, 2024

rebased and merged #8

@vytdev
Copy link
Owner

vytdev commented Sep 7, 2024

should I release a new patch now to accommodate the changes, or would you prefer to wait for a later update?

edit: done. https://github.com/vytdev/debug-stick/releases/v1.10.1

edit 2: now waiting for mcpedl to approve the update

@vytdev
Copy link
Owner

vytdev commented Sep 7, 2024

just experimenting with github comments. ignore me

debug-stick/src/index.ts

Lines 159 to 185 in b5bfff1

// displays info about the block
// edit by xAssassin to be functional after 1.21
function displayBlockInfo(player, block) {
let info = "§l§b" + block.typeId + "§r";
info += "\n§4" + block.x + " §a" + block.y + " §9" + block.z;
info += "\n§7matter state§8: §e";
if (block.isLiquid) info += "liquid";
else if (block.isAir) info += "gas";
else info += "solid";
info += "\n§7hard block§8: " + (block.isSolid ? "§ayes" : "§cno");
// Retrieve and display the block states/properties
Object.entries(block.permutation.getAllStates()).forEach(([k, v]) => {
info += "\n§o§7" + k + "§r§8: ";
if (typeof v == "string") info += "§e";
if (typeof v == "number") info += "§3";
if (typeof v == "boolean") info += "§6";
info += v;
});
// Check if the block type can be waterlogged and display the status
if (block.type.canBeWaterlogged) info += "\n§o§7waterlogged§r§8: §6" + block.isWaterlogged;
// Display block tags if available
if (block.tags) {
block.tags.forEach(tag => info += "\n§d#" + tag);
}
// Show the message to the player
message(info, player);
}

@vytdev
Copy link
Owner

vytdev commented Sep 7, 2024

@Assassin1065, I had:

  1. Merged your PR regarding the minecraft:hand_equipped addition
  2. Released a patch update here in this repo
  3. mcpedl is pending update approval (you're recognized there!)

* also i've seen your email

@vytdev vytdev removed the wontfix This will not be worked on label Sep 7, 2024
@Assassin1065
Copy link
Contributor Author

Thanks! I couldn't find any discord or other social media.

I just didnt want to see this abandoned lol.

@Assassin1065
Copy link
Contributor Author

Also yeah. I post a lot on mcpedl lol

@vytdev vytdev closed this as completed Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants