Knit It All Together
We need to add a few things from our list of materials and take care of a couple of problems.
First off, we need to fix the dying cows, so let’s add an event handler to listen for DamageHook, and cancel the event if its cause is DamageType.FALL. Ah, if we cancel the damage event, we don’t need to bump up the cow’s health.
When testing the spawn function and the jump, we used ourselves as the target. We need to do a little better than that, so we’ll have to add a getClosestPlayer() function to find the closest player to any given cow.
And as we saw earlier, we need to pick an event to use to spawn these creeper cows. There are probably a couple of ways to do that. You don’t want to spawn cows all over the world; it ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access