Sueta
FA

FastBlockAPI (Suported Versions: v1_12_R1)

1.0

FastBlockAPI is an api for developers that can place a lot of blocks with no mutch lag.

·Plugin

This source is a simple source to help devs place a lot of blocks without mutch lag.

How to use:

First You need to get the method of creating blocks.

FastBlockAPI api = FastBlockAPI.getAPI();

With this you can use the methods with api.method

setBlockFast(World world, int x, int y, int z, int blockId, byte data);
//Set the block fast without updating Light or chunk
//Example usage: setBlockFast(World,BlockCordx,BlockCordy,BlockCordz,BlockId,BlockData);


updateBlocksLight(World w,int Blockx1,int Blockz1,int Blockx2,int Blockz2);
//This method will update the Blocks light between block1 and block 2,
//Example Usage
setBlockFast(World,Corner1CordX,Corner1CordZ,Corner2CordX,Corner2CordZ);  

updateChunk(World w,int Blockx1,int Blockz1,int Blockx2,int Blockz2);
//This method will update the chunk to the server and players
//Example: same as the updateBlocksLight

Example usage of plugin:

long time = System.currentTimeMillis();

            Location loc = p.getLocation();
            int Playerx = loc.getLocation().getBlockX();
            int Playery = loc.getLocation().getBlockY();
            int Playerz = loc.getLocation().getBlockZ();

            World w = loc.getWorld();
            FastBlockAPI api = FastBlockAPI.getAPI();          

            api.updateChunk(w, Playerx +500, Playerz +500, Playerx, Playerz);
            for(int x = 0;x < 500; x++){
                for(int z = 0; z < 500; z++){
                    for(int y = 0; y < 50;y++){
                    api.setBlockFast(w, Playerx + x,Playery + y,Playerz + z,1,(byte)0);
                    }
                }
            }
           
           
            api.updateChunk(w, Playerx +500, Playerz +500, Playerx, Playerz);
            api.updateBlocksLight(w, Playerx +500, Playerz +500, Playerx, Playerz);
       
        System.out.print((System.currentTimeMillis() - time) + "ms was taken to place the blocks!");

//The above method took about 18839ms to finish.
//The block quantity is: 500x500x50 = 12.500.000

Similar projects

Plugin →