Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
events.damage(function(event) {
// Wearing a pumpkin on your head protects you from fall damage
var src = event.getDamageSource();
if (src.getDamagetype() == {
var def = event.getDefender()
var isPlayer = (def instanceof;
if (isPlayer) {
var inv = def.getInventory();
var head = inv.getSlot(39);
if (head) {
if ( == 86) {
console.log("Pumpkin on your head. Nothing to worry about.");
} else {
console.log("Nothing on your head. This hurts.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.