https://github.com/misieur/hitbox-utils
A BlockBench Plugin made to create and edit hitbox models Made by Misieur
https://github.com/misieur/hitbox-utils
blockbench blockbench-plugin minecraft
Last synced: 8 months ago
JSON representation
A BlockBench Plugin made to create and edit hitbox models Made by Misieur
- Host: GitHub
- URL: https://github.com/misieur/hitbox-utils
- Owner: misieur
- Created: 2025-08-26T12:45:15.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-08-26T14:42:01.000Z (10 months ago)
- Last Synced: 2025-08-26T20:02:42.634Z (10 months ago)
- Topics: blockbench, blockbench-plugin, minecraft
- Language: TypeScript
- Homepage:
- Size: 33.2 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HitBox Utils,
## A BlockBench Plugin made to create and edit hitbox models Made by Misieur
## How to install
See https://github.com/misieur/hitbox-utils/releases
[](https://discord.gg/5VSeDcyJt7)
## How to use it (for plugin developers)
Here is an example of how to use the file in Java using the Bukkit API. You can also look at the generated files it is just json, the generated data are the one you need to use ingame not made for blockbench, everything is handled by the blockbench plugin.
### Java
```Java
public static void spawnHitBox(JsonObject hitboxData, Location spawnLocation) {
String type = hitboxData.get("type").getAsString();
JsonArray hitboxArray = hitboxData.get("hitboxes").getAsJsonArray();
switch (type) {
case "entity" ->
hitboxArray.forEach(jsonElement -> { // You can also use happy ghasts here I am using shulkers riding item displays because it works on 1.21.2+ (below shulkers are not completely invisible)
if (jsonElement.getAsJsonObject().get("shulker_only") != null && jsonElement.getAsJsonObject().get("shulker_only").getAsBoolean()) {
JsonObject position = jsonElement.getAsJsonObject().get("position").getAsJsonObject();
ItemDisplay itemDisplay = (ItemDisplay) spawnLocation.getWorld().spawnEntity(spawnLocation.clone().add(position.get("x").getAsFloat(), position.get("y").getAsFloat(), position.get("z").getAsFloat()), EntityType.ITEM_DISPLAY);
Shulker shulkerEntity = (Shulker) spawnLocation.getWorld().spawnEntity(spawnLocation.clone().add(position.get("x").getAsFloat(), position.get("y").getAsFloat(), position.get("z").getAsFloat()), EntityType.SHULKER);
itemDisplay.addPassenger(shulkerEntity);
shulkerEntity.getAttribute(Attribute.SCALE).setBaseValue(jsonElement.getAsJsonObject().get("size").getAsFloat());
BlockFace blockFace = switch (jsonElement.getAsJsonObject().get("face").getAsInt()) { // In Minecraft they use numbers but not using bukkit
case 3 -> BlockFace.NORTH;
case 5 -> BlockFace.WEST;
default -> BlockFace.DOWN;
};
shulkerEntity.setAttachedFace(blockFace);
float peek = jsonElement.getAsJsonObject().get("height").getAsInt()/-100f;
shulkerEntity.setPeek(peek);
shulkerEntity.setAI(false);
//shulkerEntity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, PotionEffect.INFINITE_DURATION, 0, false, false));
shulkerEntity.setInvulnerable(true);
} else {
JsonObject position = jsonElement.getAsJsonObject().get("position").getAsJsonObject();
HappyGhast happyGhast = (HappyGhast) spawnLocation.getWorld().spawnEntity(spawnLocation.clone().add(position.get("x").getAsFloat(), position.get("y").getAsFloat(), position.get("z").getAsFloat()), EntityType.HAPPY_GHAST);
happyGhast.getAttribute(Attribute.SCALE).setBaseValue(jsonElement.getAsJsonObject().get("size").getAsFloat() * 0.25);
happyGhast.setAI(false);
happyGhast.setInvulnerable(true);
}
});
case "block" -> hitboxArray.forEach(jsonElement -> {
JsonObject position = jsonElement.getAsJsonObject().get("position").getAsJsonObject();
spawnLocation.getWorld().setType(spawnLocation.clone().add(position.get("x").getAsFloat(), position.get("y").getAsFloat(), position.get("z").getAsFloat()), Material.BARRIER);
});
case "interaction" -> hitboxArray.forEach(jsonElement -> {
JsonObject position = jsonElement.getAsJsonObject().get("position").getAsJsonObject();
Interaction entity = (Interaction) spawnLocation.getWorld().spawnEntity(spawnLocation.clone().add(position.get("x").getAsFloat(), position.get("y").getAsFloat(), position.get("z").getAsFloat()), EntityType.INTERACTION);
entity.setInteractionHeight(jsonElement.getAsJsonObject().get("height").getAsFloat());
entity.setInteractionWidth(jsonElement.getAsJsonObject().get("width").getAsFloat());
});
}
}
```