Giter Site home page Giter Site logo

blocksetter's Introduction

BlockSetter

You can use this to interact with blocks in any world. It works one chunk at a time, it has been tested with setting chunks to air with worlds filled with dirt up to y = 200 repeating every tick, and it stayed at 20 tps the whole time.

You can create multiple BlockTasks, They will be queued so they will not run at the same time

Example

World world = Bukkit.getWorld("World");

//This will create a blocktask that goes from -200, 0, -200 to 200, 255, 200, and sets blocks ever 1 tick.
BlockTask blockTask = new BlockTask(world, -200, 0, -200, 200, 255, 200, Material.AIR, 1);

//This will happen when a chunk is completed
blockTask.setSectionCompletable(result -> getLogger().info("Section Completed"));

//This will happen every time a whole blocktask is completed
blockTask.setFinalCompletable(result -> getLogger().info("Final Completed"));

//This will happen to every block
blockTask.setSetChangeable(block -> block.setType(Material.AIR));

// It is better to use blockTask.setMaterial(Material.Air) instead,
// because it uses nms to place the blocks

//This starts the BlockTask
blockTask.setBlocks();

It works in a grid coordinate grid pattern and starts in lowest section of grid, and works its way up Example: Coordinate grid from -500, -500 to 500, 500 It will find the chunk that -500, -500 occupies, and start from there. It will cycle the chunk up to the y coordinate specified as the height limit. Once that is done, it moves to the next chunk in the x direction, so if for example the chunk started on -500, -500 exactly, after cycling through to -484, -484, it would go to -468, -484. Once it gets to 500, 500 it repeats, except it starts at -500, -484

blocksetter's People

Contributors

fisher2911 avatar dkim19375 avatar

Watchers

 avatar

blocksetter's Issues

Block Set Increases Over Time

In this part of the BlockTask.setBlocks():

        if (xMax < endX) {
            xMax += blocksPerSection;
        } else if (zMax < endZ) {
            x = startX;
            xMax = startX + blocksPerSection;
            zMax += blocksPerSection;
            z+=blocksPerSection;
        } else if (y < endY) {
            x = startX;
            z = startZ;
            xMax = startX + blocksPerSection;
            zMax = startZ + blocksPerSection;
            y++;
        } else {
            plugin.removeBlockTask();
            if (finalCompletable != null) finalCompletable.onComplete(result);
            return;
        }

The amount of blocks set gradually increase, the fix should be to add
x += blocksPerSection;
in

    if (xMax < endX) {
            xMax += blocksPerSection;
        }

I still have to test it though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.