i need a way to have my plugin fill - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: i need a way to have my plugin fill (/thread-3443.html) |
i need a way to have my plugin fill - Alland20201 - 10-12-2024 im working on a minigame plugin and i didnt get setblock to work function PlayerJoined(Player) local World = Player:GetWorld() local position = Vector3i(0, 500, 0) local bedrock = 7 World:FastSetBlock(position, bedrock, 0) end RE: i need a way to have my plugin fill - NiLSPACE - 10-12-2024 Minecraft coordinates use y for height, so you're trying to set a block at y=500 which can't be done because Cuberite only supports heights from 0 to 255. You can also use the E_BLOCK_XYZ enums so you don't have to declare every block. -- Sets the block where the player is to bedrock function PlayerJoined(Player) local World = Player:GetWorld() local position = Player:GetPosition():Floor():addedY(-1); World:FastSetBlock(position, E_BLOCK_BEDROCK, 0) end RE: i need a way to have my plugin fill - NiLSPACE - 10-12-2024 Alland20201 Wrote:Thanks! tho i need a way to fill a 3x3 plattform. do u know how without some messy code You could use a loop for both x and z coordinate to do that like this: function PlacePlatformAt(world, middlepoint, radius) for x = -radius, radius do for z = -radius, radius do world:FastSetBlock(middlepoint:addedXZ(x,z), E_BLOCK_BEDROCK, 0) end end end You could also use the cBlockArea api which is more performant: function PlacePlatformAt(world, middlepoint, radius) local ba = cBlockArea() ba:Create(radius * 2 + 1, 1, radius * 2 + 1, cBlockArea.baTypes + cBlockArea.baMetas) ba:Fill(cBlockArea.baTypes + cBlockArea.baMetas, E_BLOCK_BEDROCK, 0, 0, 0); ba:Write(world, middlepoint:addedXZ(-radius, -radius), cBlockArea.baTypes + cBlockArea.baMetas); end |