ModsJava
BlockStorage API
Minecraft Java mod. Downloads from the MC Java Mods app on Android.
⬇ Download on Spigot
BlockStorage API
This api plugin allows you to store the data for each block in any coordinates in any chunk in separate files so that even after a server restart you can get your unique data for each block
Code (Java):
package
me.nome.BlockStorage
;
import java.io.IOException ;
import org.bukkit.plugin.java.JavaPlugin ;
public class Main extends JavaPlugin {
public static void main ( String [ ] args ) {
int chunkX = 0 ;
int chunkZ = 15 ;
//Create instance of ChunkContent(This instance save custom data for all blocks in this chunk)
ChunkContent chunk = new ChunkContent (chunkX,chunkZ ) ;
int blockX = 0 ;
int blockY = 0 ;
int blockZ = 0 ;
//Create instance of BlockContent(This instnace save custom data for block)
BlockContent blockContent = new BlockContent ( ) ;
//With method set from BlockContent you can save custom data;
blockContent. set ( "myData", "myContent" ) ;
blockContent. set ( "private", true ) ;
blockContent. set ( "counter", 0 ) ;
int block2X = 0 ;
int block2Y = 0 ;
int block2Z = 1 ;
BlockContent blockContent2 = new BlockContent ( ) ;
//With method set from BlockContent you can save custom data;
blockContent. set ( "myData", "myContent" ) ;
blockContent. set ( "private", true ) ;
blockContent. set ( "counter", 0 ) ;
// Method addBlock save block custom data in current ChunkContent instance
chunk. addBlock (block2X, block2Y, block2Z, blockContent2 ) ;
/*
* Creates a file structure that specifies the path where the chunk file itself
* will be physically stored along with the written blocks and their data in them
* This instance describes a file that will be called x-z.bin where x and z are real coordinates of the chunk
*/
ChunkFile chunkFile = new ChunkFile ( "./",chunkX, chunkZ ) ;
try {
//This method will create a file and write the chunk data to it
ChunkFileStorage. writeChunk (chunkFile, chunk ) ;
} catch ( IOException e ) {
// TODO Auto-generated catch block
e. printStackTrace ( ) ;
}
try {
/*
* This method will read a chunk from a file
*/
ChunkContent readedChunkFromFile = ChunkFileStorage. readChunk (chunkFile ) ;
} catch ( ClassNotFoundException | IOException e ) {
// TODO Auto-generated catch block
e. printStackTrace ( ) ;
}
//This method check if exists chunkFile
if (ChunkFileStorage. existsChunkFile (chunkFile ) ) {
}
}
}
import java.io.IOException ;
import org.bukkit.plugin.java.JavaPlugin ;
public class Main extends JavaPlugin {
public static void main ( String [ ] args ) {
int chunkX = 0 ;
int chunkZ = 15 ;
//Create instance of ChunkContent(This instance save custom data for all blocks in this chunk)
ChunkContent chunk = new ChunkContent (chunkX,chunkZ ) ;
int blockX = 0 ;
int blockY = 0 ;
int blockZ = 0 ;
//Create instance of BlockContent(This instnace save custom data for block)
BlockContent blockContent = new BlockContent ( ) ;
//With method set from BlockContent you can save custom data;
blockContent. set ( "myData", "myContent" ) ;
blockContent. set ( "private", true ) ;
blockContent. set ( "counter", 0 ) ;
int block2X = 0 ;
int block2Y = 0 ;
int block2Z = 1 ;
BlockContent blockContent2 = new BlockContent ( ) ;
//With method set from BlockContent you can save custom data;
blockContent. set ( "myData", "myContent" ) ;
blockContent. set ( "private", true ) ;
blockContent. set ( "counter", 0 ) ;
// Method addBlock save block custom data in current ChunkContent instance
chunk. addBlock (block2X, block2Y, block2Z, blockContent2 ) ;
/*
* Creates a file structure that specifies the path where the chunk file itself
* will be physically stored along with the written blocks and their data in them
* This instance describes a file that will be called x-z.bin where x and z are real coordinates of the chunk
*/
ChunkFile chunkFile = new ChunkFile ( "./",chunkX, chunkZ ) ;
try {
//This method will create a file and write the chunk data to it
ChunkFileStorage. writeChunk (chunkFile, chunk ) ;
} catch ( IOException e ) {
// TODO Auto-generated catch block
e. printStackTrace ( ) ;
}
try {
/*
* This method will read a chunk from a file
*/
ChunkContent readedChunkFromFile = ChunkFileStorage. readChunk (chunkFile ) ;
} catch ( ClassNotFoundException | IOException e ) {
// TODO Auto-generated catch block
e. printStackTrace ( ) ;
}
//This method check if exists chunkFile
if (ChunkFileStorage. existsChunkFile (chunkFile ) ) {
}
}
}
Quick facts
- Edition: Minecraft Java
- File type: .jar
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
BlockStorage API is a free Minecraft Java mod. Downloaded 127 times (via Spigot). Download it and open it directly in the game.