From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 3 May 2019 23:58:44 -0500
Subject: [PATCH] Snowman drop and put back pumpkin


diff --git a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
index fcf3092ef1863f62d9e76a77c0299ce1495ca1b7..ee64f4084b25d77f1c25b76a5b7d90cd2547bffb 100644
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
@@ -184,6 +184,14 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
             }
 
             return InteractionResult.sidedSuccess(this.level.isClientSide);
+            // Purpur start
+        } else if (level.purpurConfig.snowGolemPutPumpkinBack && !hasPumpkin() && itemstack.getItem() == Blocks.CARVED_PUMPKIN.asItem()) {
+            setPumpkin(false);
+            if (!player.getAbilities().instabuild) {
+                itemstack.shrink(1);
+            }
+            return InteractionResult.SUCCESS;
+            // Purpur end
         } else {
             return tryRide(player, hand); // Purpur
         }
@@ -195,6 +203,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
         if (!this.level.isClientSide()) {
             this.setPumpkin(false);
             this.forceDrops = true; // CraftBukkit
+            if (level.purpurConfig.snowGolemDropsPumpkin) // Purpur
             this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), 1.7F);
             this.forceDrops = false; // CraftBukkit
         }
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index aec3017ebc2155e88939e43101fa9e958c9d2102..d88a99003b84663fe6a50884f03eb78921c02937 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -997,6 +997,8 @@ public class PurpurWorldConfig {
     public boolean snowGolemRidableInWater = false;
     public boolean snowGolemLeaveTrailWhenRidden = false;
     public double snowGolemMaxHealth = 4.0D;
+    public boolean snowGolemDropsPumpkin = true;
+    public boolean snowGolemPutPumpkinBack = false;
     private void snowGolemSettings() {
         snowGolemRidable = getBoolean("mobs.snow_golem.ridable", snowGolemRidable);
         snowGolemRidableInWater = getBoolean("mobs.snow_golem.ridable-in-water", snowGolemRidableInWater);
@@ -1007,6 +1009,8 @@ public class PurpurWorldConfig {
             set("mobs.snow_golem.attributes.max_health", oldValue);
         }
         snowGolemMaxHealth = getDouble("mobs.snow_golem.attributes.max_health", snowGolemMaxHealth);
+        snowGolemDropsPumpkin = getBoolean("mobs.snow_golem.drop-pumpkin-when-sheared", snowGolemDropsPumpkin);
+        snowGolemPutPumpkinBack = getBoolean("mobs.snow_golem.pumpkin-can-be-added-back", snowGolemPutPumpkinBack);
     }
 
     public boolean squidRidable = false;
