-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature/rtp #9
base: master
Are you sure you want to change the base?
Feature/rtp #9
Conversation
CommandManager.literal("rtp") | ||
.executes { rtpCommand(it) } | ||
) | ||
dispatcher.register( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't do this - see @gdude2002's comment on my tpa PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused as to what not to do and can't seem to find his comment pertaining to registering commands, which is what I'm assuming this is about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, are you referring to him saying that each command should have its own class? /rtp and /wild are the same command, wild is just an alias for rtp, so I thought this was how to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like an alias - since it executes the same code. The way Minecraft does aliases is creating a CommandNode
or whatever it's called (I don't remember Brigadier names) and using .redirect
on the alias and passing in that node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, well I didn't really know how to create a proper alias, but what I did is how the Fabric wiki showed how to do it. I can look into it and change it though
edit: Turns out, I managed to completely misread the wiki. I don't even know how I came up with what's here right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fun register() {
val node = registerMain()
dispatcher.register(
CommandManager.literal("wild")
.redirect(node)
)
}
fun registerMain(): LiteralCommandNode<ServerCommandSource> {
return dispatcher.register(
CommandManager.literal("rtp")
.executes { rtpCommand(it) }
)
}
I did this based on what I could understand from the wiki. In game, it creates a /wild command, but when it is run, it gives the 'unknown command' error. Got any suggestions? (also, /rtp still works as expected)
A question that I have is, why did you go through the pain of making this entire thing on GitHub instead of using an IDE? |
No no no, I made it all in IntelliJ, but since it's part of a project that has all your /tpa and /back features, plus /spawn and /setspawn from my other PR, I only copied over the new files that affected this feature when making this pr. Writing this all in GitHub would just be pain |
it's not from this pr, it shouldnt be here
this was only used because setBackPos was being used
} | ||
|
||
private fun getHighestBlock(world: ServerWorld?, x: Int, z: Int): Int { | ||
val heightLimit = world!!.heightLimit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The auto build check keeps failing, saying that heightLimit cannot be found, but it works when I build it on my computer. From what I can tell, the file I have is the same as this one except for the few /back related lines.
This is not entirely completed as I'd like to add a few things:
0 0
)this has been removedRtpCommand.kt
calls the methodPlayerDataManager.setBackPos
on line 61, which uses the back feature of @YTG1234's PR.