-
Notifications
You must be signed in to change notification settings - Fork 3
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
setBlock is too slow #3
Comments
Hi there 👋 First off, I am very happy that you found the repository and decided to use it. 😁 Regarding the version/compatibility, the plugin is written using a certain Bukkit API, which means it is compatible with Minecraft 1.18.2, but as Bukkit takes great care to allow plugins to remain backwards compatible (in most cases), the plugin automatically works for newer versions as well (as long as Bukkit does not introduce any breaking changes in the API). Regarding the speed of the methods, generally there are two types of function calls, synchronous and asynchronous ones: Most methods that do not return a specific response are asynchronous, such as But as I said, the cost is for each individual call, and because you often want to set many blocks of the same type, there is the Your code could be made significantly faster with this method, for example: from mcpq import Minecraft, Vec3
mc = Minecraft() # connect to server on localhost
mc.postToChat("Hello Minecraft!")
def setBlocks(block_id, start, end):
positions = []
for x in range(min(start.x, end.x), max(start.x, end.x + 1)):
for y in range(min(start.y, end.y), max(start.y, end.y + 1)):
for z in range(min(start.z, end.z), max(start.z, end.z + 1)):
positions.append(Vec3(x, y, z))
mc.setBlockList(block_id, positions)
setBlocks("air", Vec3(-40, 63, -40), Vec3(40, 70, 40))
setBlocks("gold_block", Vec3(-40, 61, -40), Vec3(40, 61, 40))
setBlocks("grass_block", Vec3(-40, 62, -40), Vec3(40, 62, 40)) In comparison to MCPI, which limits the number of operations per tick to 9000 I believe, MCPQ allows an unlimited number of operations and you should - theoretically - be able to use as much of the server resources as you want. PS: If you want to set a cube of one blocktype use the |
Excellent! Thanks for the detailed explanation. Regarding plugin servers and APIs, I am still confused about the relationship between Bukkit, CraftBukkit, Spigot, Paper, and Purpur. Bukkit is the API, CraftBukkit is the original plugin server using Bukkit, and Spigot, Paper and Purpur are derived from CraftBukkit. Is this correct? Then which API documentation exactly are you referring to?? The Bukkit and CraftBukkit projects have already been shut down, and I assume the API is maintained by the Spigot people, on the other hand, Spigot's GitHub repository has already been archived. Anyway the efforts to maintain backward compatibility are just great, indeed. I have a general understanding of the elements related to protocol. I also tried the digital clock with LCD matrix font which was originally written for Raspberry Pi 3. I used double buffer and setBlock to update limited blocks that only changed from the past second. The reason is to make it possible to complete the update during one second regarding the processing power of Raspberry Pi. But now, flipping the buffer like pygame with setBlockList should be much better with MCPQ. The MCPQ 1.0.1 documentation is great, too. I will make another issue regarding build instructions for plugin, and one more issue regarfing the setup for this repo. https://github.com/user-attachments/assets/9c76911b-8c7c-4a02-b9bc-d9f0f39b2193 |
Your welcome 👋 Regarding the API/Servers:
As far as I can tell, all of these projects are still supported/maintained, the Bukkit, CraftBukkit and Spigot projects moved to the Spigot team's Bitbucket instance. For MCPQ, I am using the Bukkit API version 1.18.2 here and otherwise no other dependencies. This has advantages and disadvantages: Pros:
Cons:
Regarding the speed of setBlock operations: Regarding the digital clock: Regarding the new issues: |
Wow, that was most clear. I will use PaperMC along with you for a while. They seem to have great documentations: And I'm happy to wait to see the improvements in speed of setBlock operations to come. The original version of the digital clock is here: https://github.com/Naohiro2g/minecraft_remote The plugin build:
The python package: For my repo Naohiro2g/minecraft_remote, the intention was to create an integrated framework compatible with MCPI-MCJE1.12.2 / MCJE1.13+. (Almost) same code runs everywhere. We can use many legacy MCPI samples and our future codes will run on MCPI, too. But it could be much smarter. Apart from that, I will update the repo with the recent insights about utilizing plugin servers to enjoy remote controll over the latest Minecraft as a breaking news. Another idea would be to implement a websocket client plugin to communicate with the proxy server via a websocket tunnel. This plugin might allow the use of inexpensive rental servers that do not give me root admin. |
Agreed. I have used Paper with much success in the past, as it works well w.r.t. performance and runs efficiently even on low end systems, like the student's laptops.
Great 😁 Yes the entire library is still very much in development and I have plans for more features.
Thanks, you have quite the nice collection of tools there. You probably want to integrate MCPQ into your remote repo?
The
It's likely that the version can be upgraded, but you might also have to upgrade all dependence-libraries and check for compatibility issues. I might upgrade to Java21 in the future but it's not a priority.
You don't have to know anything. The entire build process is described in metadata in the |
Hi, for the Java switching, I've installed the SDKMAN and it's working. Just now, PaperMC with the JuicyRaspberryPie plug-in is running on one of my computer at home and is available on the Internet for my students. Students can now remotely control the Minecraft world. I've been trying to figure out how to protect that world from vandalism or a baggy code, and I realized that this plugin has no user authentication mechanism, so it's impossible. Furthermore, I am guessing there is no user authentication even at the API level, what do you think? My concept was to allocate an area of about 2000x400x2000 to each player, with no one allowed to destroy/build except their own area, and to allocate a shared area to each group to make it a place for collaborative work. If the destruction/building works are done by hand or by WorldEdit, etc., it could be managed by the WorldGuard plugin. Oh, If the player injects Python code and the plugin executes it, it might be manageable, but that sounds like a Trojan horse. Besides, it's a one-way operation, which we don't need; we need interaction, like playing reversi in a Minecreaft world. Or like playing rock-paper-scissors with the CPU using image recognition. |
demo movie. Sorry this was not done by MCPQ, I'll make it later. |
Hi, so first let me just say that MCPQ is designed with the idea that having access the MCPQ gives you access to the entire server. Having full control of the server was always the goal and I do not believe I will add any user-separated authentification. However, gRPC is fully operable - and even designed for - use over the network and supports a large number of secure connection features using SSL/HTTPS or token-based authentification. Python Auth Example. For your use case, you might want to implement the authentification via a proxy, as then you could also control not only who can access what part of the world but also which methods they can use. The protocol defines all allowed methods/access to the Minecraft world. Again, your best bet is probably a proxy, where you check the commands sent by the students and allow certain ones, in certain quantities or certain areas. This would give you a lot of fine control and also allow you to have a uniform interface for the students while using multiple plugins in the background. Regarding allowing Python code to be injected, that sounds like an even harder problem to correctly sandbox. I looked into that briefly (there are some projects that would help) but again, its sounds like too much of a hassle. Let me know how you decide to tackle this problem 👋 PS: The only feature that the plugin currently has is the |
Hi, I have been using MCPI with my students for a long time and was tied to 1.16.5 because I was using a modified MCPI with the Forge mod. Last week I noticed the possibility of using newer versions of Minecraft on the plugin server with plugins out there.
First I tried Spigot, then PaperMC, then PurpurMC with success with the 1.18.2 compatible websocket plugin. At that time I was thinking that there was still a lot of work left to do to make the mods as well as the plugins compatible with the latest Minecraft versions.
Then yesterday I happened to find your repository and decided to give it a try, and was surprised to see that it says it would work with 1.18.2+. So I tried using the 1.18.2 compatible websocket plugin with PurpurMC 1.21.1 and confirmed that at least postToChat and setBlock work. Excuse me???
And as you mentioned, the release version of the MCPQ-plugin also worked fine. Amazing.
Then I wrote a little MCPQ code and tried it, and noticed that setBlock is very slow. Slowing down is sometimes very good to show off the process of building but ... Is there any limit to how fast setBlock can work? Or about the communication speed?
Here is my code:
The text was updated successfully, but these errors were encountered: