Files
Purpur/patches/todo/server/0041-Snowman-drop-and-put-back-pumpkin.patch
Ben Kerllenevich e217008618 maybe we API
2022-06-07 14:53:59 -04:00

56 lines
3.0 KiB
Diff

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 f7863f9703c7ab5f2f1faac7a52311ed7ef79042..1336fd13ce69812e2eae6fb8fb91575006e9a318 100644
--- a/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
+++ b/src/main/java/net/minecraft/world/entity/animal/SnowGolem.java
@@ -192,6 +192,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(true);
+ if (!player.getAbilities().instabuild) {
+ itemstack.shrink(1);
+ }
+ return InteractionResult.SUCCESS;
+ // Purpur end
} else {
return tryRide(player, hand); // Purpur
}
@@ -203,6 +211,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/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 0d042476484fd6fd2e7ad98cb695e80be2e0a1d4..54c0fe906604b14314125ff35322f75c84c1ee7d 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1131,6 +1131,8 @@ public class PurpurWorldConfig {
public boolean snowGolemControllable = true;
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);
@@ -1142,6 +1144,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;