Simple tool for converting blockbench hitboxes to eaglercraft.
With bonus hitbox rotation code! (Please credit if used)
v1.0 - Base source code
- Use java model inside of blockbench
- Create box around model for desired hitbox
- Copy the box's position and size and input into tool
- Copy exported eaglercraft code
- Use the code!
Replace values inside of float[] bounds = {}; with output from tool.
float[] bounds = {0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F};
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) {
EnumFacing enumfacing = worldIn.getBlockState(pos).getValue(FACING);
this.setBlockBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
if (enumfacing == EnumFacing.NORTH) {
this.setBlockBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
} else if (enumfacing == EnumFacing.SOUTH) {
this.setBlockBounds(1.0F - bounds[3], bounds[1], 1.0F - bounds[5], 1.0F - bounds[0], bounds[4], 1.0F - bounds[2]);
} else if (enumfacing == EnumFacing.EAST) {
this.setBlockBounds(1.0F - bounds[5], bounds[1], bounds[0], 1.0F - bounds[2], bounds[4], bounds[3]);
} else if (enumfacing == EnumFacing.WEST) {
this.setBlockBounds(bounds[2], bounds[1], 1.0F - bounds[3], bounds[5], bounds[4], 1.0F - bounds[0]);
}
}Finally here is the live version of the code!