mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
60 lines
2.8 KiB
Diff
60 lines
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Sun, 12 May 2019 01:14:46 -0500
|
|
Subject: [PATCH] |FEAT| Pigs give saddle back
|
|
|
|
Make pigs give your saddle back without killing them by shift right clicking the pig
|
|
|
|
$-----------------------------$
|
|
mobs:
|
|
pig:
|
|
give-saddle-back:
|
|
default: false
|
|
description: |-
|
|
Sneak right-click a pig that has a saddle on it's back to remove the saddle
|
|
$-----------------------------$
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Pig.java b/src/main/java/net/minecraft/world/entity/animal/Pig.java
|
|
index f4a099e691dce3c57069e76d67859161b459098e..518d28dc0b5b8c04263c93a4347e4c971a1318d8 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Pig.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Pig.java
|
|
@@ -173,6 +173,18 @@ public class Pig extends Animal implements ItemSteerable, Saddleable {
|
|
|
|
if (!flag && this.isSaddled() && !this.isVehicle() && !player.isSecondaryUseActive()) {
|
|
if (!this.level.isClientSide) {
|
|
+ // Purpur start
|
|
+ if (level.purpurConfig.pigGiveSaddleBack && player.isCrouching()) {
|
|
+ this.steering.setSaddle(false);
|
|
+ if (!player.getAbilities().instabuild) {
|
|
+ ItemStack saddle = new ItemStack(Items.SADDLE);
|
|
+ if (!player.getInventory().add(saddle)) {
|
|
+ player.drop(saddle, false);
|
|
+ }
|
|
+ }
|
|
+ return InteractionResult.SUCCESS;
|
|
+ }
|
|
+ // Purpur end
|
|
player.startRiding(this);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index c5124c7beff61ea1a60db0b0e14f99f3302831b9..91d62888b6012b51b1eeb29b864d7d560397b7c1 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -779,6 +779,7 @@ public class PurpurWorldConfig {
|
|
public boolean pigRidable = false;
|
|
public boolean pigRidableInWater = false;
|
|
public double pigMaxHealth = 10.0D;
|
|
+ public boolean pigGiveSaddleBack = false;
|
|
private void pigSettings() {
|
|
pigRidable = getBoolean("mobs.pig.ridable", pigRidable);
|
|
pigRidableInWater = getBoolean("mobs.pig.ridable-in-water", pigRidableInWater);
|
|
@@ -788,6 +789,7 @@ public class PurpurWorldConfig {
|
|
set("mobs.pig.attributes.max_health", oldValue);
|
|
}
|
|
pigMaxHealth = getDouble("mobs.pig.attributes.max_health", pigMaxHealth);
|
|
+ pigGiveSaddleBack = getBoolean("mobs.pig.give-saddle-back", pigGiveSaddleBack);
|
|
}
|
|
|
|
public boolean piglinRidable = false;
|