From e4a7d439a42b6139c1fe3308fdeaf1b5f8857b1a Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Sun, 12 May 2019 01:14:46 -0500 Subject: [PATCH] Pigs give saddle back --- src/main/java/net/minecraft/server/EntityPig.java | 12 ++++++++++++ src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java index cd0a94794..cf2df391a 100644 --- a/src/main/java/net/minecraft/server/EntityPig.java +++ b/src/main/java/net/minecraft/server/EntityPig.java @@ -109,6 +109,18 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable { if (!flag && this.hasSaddle() && !this.isVehicle()) { if (!this.world.isClientSide) { + // Purpur start + if (world.purpurConfig.pigGiveSaddleBack && entityhuman.isSneaking()) { + this.saddleStorage.setSaddle(false); + if (!entityhuman.abilities.canInstantlyBuild) { + ItemStack saddle = new ItemStack(Items.SADDLE); + if (!entityhuman.inventory.pickup(saddle)) { + entityhuman.drop(saddle, false); + } + } + return EnumInteractionResult.SUCCESS; + } + // Purpur end entityhuman.startRiding(this); } diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java index faddf7c4b..84c025c4a 100644 --- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java @@ -161,6 +161,11 @@ public class PurpurWorldConfig { ironGolemCanSwim = getBoolean("mobs.iron_golem.can-swim", ironGolemCanSwim); } + public boolean pigGiveSaddleBack = false; + private void pigSettings() { + pigGiveSaddleBack = getBoolean("mobs.pig.give-saddle-back", pigGiveSaddleBack); + } + public String polarBearBreedableItemString = ""; public Item polarBearBreedableItem = null; private void polarBearSettings() { -- 2.26.2