Skip to content

setBlock is too slow #3

Closed
Closed
@Naohiro2g

Description

@Naohiro2g

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:

from mcpq import Minecraft, Vec3

mc = Minecraft()  # connect to server on localhost

mc.postToChat("Hello Minecraft!")

def setBlocks(block_id, start, end):
    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)):
                mc.setBlock(block_id, Vec3(x, y, z))


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))

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions