Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/TheGaming999/BlockChanger
1.7 - 1.20.4 util that allows you to change blocks at blazing fast speeds
https://github.com/TheGaming999/BlockChanger
Last synced: about 1 month ago
JSON representation
1.7 - 1.20.4 util that allows you to change blocks at blazing fast speeds
- Host: GitHub
- URL: https://github.com/TheGaming999/BlockChanger
- Owner: TheGaming999
- License: wtfpl
- Created: 2022-04-19T18:00:55.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-12T12:31:04.000Z (11 months ago)
- Last Synced: 2024-08-02T05:13:04.970Z (4 months ago)
- Language: Java
- Homepage:
- Size: 138 KB
- Stars: 50
- Watchers: 2
- Forks: 10
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-blazingly-fast - BlockChanger - 1.7 - 1.18 utility class that allows you to change blocks at blazing fast speeds (Java)
README
# BlockChanger
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FTheGaming999%2FBlockChanger.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FTheGaming999%2FBlockChanger?ref=badge_shield)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/a1ecc2905ea14fd39b29a5a3df2d124c)](https://www.codacy.com/gh/TheGaming999/BlockChanger/dashboard?utm_source=github.com&utm_medium=referral&utm_content=TheGaming999/BlockChanger&utm_campaign=Badge_Grade)
A single class that offers very fast block placement methods from NMS using static final method handles, inheritance, and abstraction, designed to support multiple versions (1.7.10 - 1.20.4) and minimize the overhead of reflection as much as possible. Currently, only the first three methods from the thread below are supported.
Please refer to this thread for more information: (https://www.spigotmc.org/threads/methods-for-changing-massive-amount-of-blocks-up-to-14m-blocks-s.395868/)### Setup
Just import the class to your project.
### Usage
```java
// player location as an example.
Player player = ...
BlockChanger.setBlock(player.getLocation(), Material.GOLD_BLOCK);
BlockChanger.setBlock(player.getLocation(), new ItemStack(Material.GOLD_BLOCK));// Usage of async methods is the same as the regular methods.
// Type 1: Set block by NMS World method (nmsWorld#setTypeAndData) (80-90K blocks per second)
BlockChanger.setBlockAsynchronously(player.getLocation(), new ItemStack(Material.STONE), false);
// Type 2: Set block by NMS Chunk method (nmsChunk#setType) (2.19M blocks per second)
BlockChanger.setChunkBlockAsynchronously(player.getLocation(), new ItemStack(Material.DIRT), false);
// Type 3: Set block by NMS ChunkSection method (nmsChunkSection#setType) (7.9M blocks per second)
BlockChanger.setSectionBlockAsynchronously(player.getLocation(), new ItemStack(Material.GOLD_ORE), false);// cornerA and cornerB are locations.
// This method returns a CompletableFuture, which gets completed once all blocks are set.
BlockChanger.setCuboidAsynchronously(cornerA, cornerB, new ItemStack(Material.DIAMOND_BLOCK), false)
.thenRun(() -> {
// gets executed after cuboid has been filled entirely
Bukkit.broadcastMessage("COMPLETED!");
});// Fastest method (setSection).
BlockChanger.setSectionCuboidAsynchronously(corner1, corner2, new ItemStack(Material.GLASS), false)
.thenRunAsync(() -> {
Bukkit.broadcastMessage("COMPLETED!");
});BlockChanger. // see all the methods
```
### ToDo
- Method to update lighting?## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FTheGaming999%2FBlockChanger.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FTheGaming999%2FBlockChanger?ref=badge_large)