Updated the cast error fix by Lertsenem for 1.7.2a

This is the same change as in the [pull request](https://github.com/watabou/pixel-dungeon/pull/1) by @Lertsenem for **1.7.1c**, except updated to merge against **1.7.2a**. Without it, **pixel-dungeon** can't be compiled in some environments, such as with (at least) **ant** and **openjdk7**/**8**.