private void hurt(Level level, int x, int y, int dmg) {
{
int count = random.nextInt(10) == 0 ? 1 : 0;
for (int i = 0; i < count; i++) {
level.add(new ItemEntity(new ResourceItem(Resource.apple), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
}
}
int damage = level.getData(x, y) + dmg;
level.add(new SmashParticle(x * 16 + 8, y * 16 + 8));
level.add(new TextParticle("" + dmg, x * 16 + 8, y * 16 + 8, Color.get(-1, 500, 500, 500)));
if (damage >= 20) {
int count = random.nextInt(2) + 1;
for (int i = 0; i < count; i++) {
level.add(new ItemEntity(new ResourceItem(Resource.wood), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
}
count = random.nextInt(random.nextInt(4) + 1);
for (int i = 0; i < count; i++) {
level.add(new ItemEntity(new ResourceItem(Resource.acorn), x * 16 + random.nextInt(10) + 3, y * 16 + random.nextInt(10) + 3));
}
level.setTile(x, y, Tile.grass, 0);
} else {
level.setData(x, y, damage);
}