ModsJava
[API] NBTInjector
Java mod listed for Minecraft 1.8–1.10. Download on the author's site.
⬇ Download on SpigotThis API allows you to inject custom and persistent NBT data into entities or tile-entities (blocks).
Note: This needs to be installed as a plugin, so it can inject the entity classes properly. This is also somewhat experimental and not tested with a lot of other plugins, so use this at your own risk.
Example Usage
(
https://gist.github.com/InventivetalentDev/b17cc5196afc20b19e70579c5369a85b)
Adds a persistent clickCount tag to entities which increases with every click.
You may also want to check out NBTLibrary, which is already included with this plugin.
Maven
Links
Note: This needs to be installed as a plugin, so it can inject the entity classes properly. This is also somewhat experimental and not tested with a lot of other plugins, so use this at your own risk.
Example Usage
Code (Java):
Bukkit.
getPluginManager
(
).
registerEvents
(
new Listener
(
)
{
@EventHandler
public void on (PlayerInteractEntityEvent event ) {
CompoundTag tag = NBTInjector. getNbtData ( ( Entity ) event. getRightClicked ( ) ) ;
if (tag != null ) {
NBTTag countTag = tag. get ( "clickCount" ) ;
if (countTag == null ) { countTag = new IntTag ( ) ; }
tag. set ( "clickCount", countTag. getAsInt ( ) + 1 ) ;
}
}
@EventHandler
public void on (PlayerInteractEvent event ) {
if (event. getClickedBlock ( ) != null ) {
CompoundTag tag = NBTInjector. getNbtData (event. getClickedBlock ( ). getState ( ) ) ;
if (tag != null ) {
NBTTag countTag = tag. get ( "clickCount" ) ;
if (countTag == null ) { countTag = new IntTag ( ) ; }
tag. set ( "clickCount", countTag. getAsInt ( ) + 1 ) ;
}
}
}
}, this ) ;
@EventHandler
public void on (PlayerInteractEntityEvent event ) {
CompoundTag tag = NBTInjector. getNbtData ( ( Entity ) event. getRightClicked ( ) ) ;
if (tag != null ) {
NBTTag countTag = tag. get ( "clickCount" ) ;
if (countTag == null ) { countTag = new IntTag ( ) ; }
tag. set ( "clickCount", countTag. getAsInt ( ) + 1 ) ;
}
}
@EventHandler
public void on (PlayerInteractEvent event ) {
if (event. getClickedBlock ( ) != null ) {
CompoundTag tag = NBTInjector. getNbtData (event. getClickedBlock ( ). getState ( ) ) ;
if (tag != null ) {
NBTTag countTag = tag. get ( "clickCount" ) ;
if (countTag == null ) { countTag = new IntTag ( ) ; }
tag. set ( "clickCount", countTag. getAsInt ( ) + 1 ) ;
}
}
}
}, this ) ;
Adds a persistent clickCount tag to entities which increases with every click.
You may also want to check out NBTLibrary, which is already included with this plugin.
Maven
Code (XML):
<repositories>
<repository>
<id>inventive-repo </id>
<url>https://repo.inventivetalent.org/content/groups/public/ </url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.inventivetalent </groupId>
<artifactId>nbtinjector </artifactId>
<version>VERSION </version>
</dependency>
</dependencies>
<repository>
<id>inventive-repo </id>
<url>https://repo.inventivetalent.org/content/groups/public/ </url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.inventivetalent </groupId>
<artifactId>nbtinjector </artifactId>
<version>VERSION </version>
</dependency>
</dependencies>
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.8, 1.9, 1.10
- 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.
[API] NBTInjector is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.9, 1.10. Downloaded 475 times (via Spigot). Download it and open it directly in the game.