About two weeks ago, one of my collaborators told me that he was setting up a virtual university in Minecraft, and was trying to utilize existing image on map plugins to display slides in his server. I thought it must be exhausting to play slides in this way, so I decided to develop a plugin to ease his pain.
EusMapDisplay
First things first, a mechanism for detecting where the user is targeting at the hung map is required for achieve the goal.
And here’s the code:
|
This is not enough. With the method above, they only thing we get to know is the exact coordinates where the player is looking at, but what we actually want is the 2D coordinates inside a display.
This gif shows the first version of the 2D coordinates conversion, it’s bogus.
The cursor just won’t move to where we want it to be.
So here’s what I eventually figured out about making the cursor being accurate:
|
The getTargetAbsoluteCoordinates()
is not elegant so far, but it works fine and satisifys requirements for testing out my idea.
So far so good. Here’s the demo.
I validated the algorithem’s correctiveness by putting up the four-directionary “screen cubes” in all of the four quadrants, i.e. +X and +Z, +X and -Z, -X and +Z, -X and -Z.
With the cursor being precise, I added events support.
EusMapDisplay is opensource at https://github.com/richardhyy/EusMapDisplay .
Demo Application: Screen Mirroring
With the framework finished, I made a demo plugin for test purpose.
This plugin mirrors the server’s screen into Minecraft.
Next Step: EusReader
I’ve been working on the slideshow plugin for two days. Till now, it has the ability to manage multiple documents for every single player, and page flipping has been implemented.
While I was developing the plugin, an issue related to wheel scrolling was solved. The problem existed because the listener failed to handling the case where the player swap between the first and the last slot.
The following is the polished gist of sourcecode that calculates the wheelAmt
value.
|
Here’s the scrolling demo:
As you can see, it’s not fast and smooth, so there is still a long way to go before the EusReader plugin become usable.
Pause
The summer vacation is halfway through now. For my further development, it would be better to take a respite and go back to the fundamental knowledge learning.