mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
49 lines
2.6 KiB
Diff
49 lines
2.6 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] Pigs give saddle back
|
|
|
|
|
|
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 8b9318713764f8429221b4f6fb162018408f5e1e..294545914dec0a06eadb6c2f139222b3f1a6f64c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Pig.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Pig.java
|
|
@@ -180,6 +180,17 @@ public class Pig extends Animal implements ItemSteerable, Saddleable {
|
|
public InteractionResult mobInteract(Player player, InteractionHand hand) {
|
|
boolean flag = this.isFood(player.getItemInHand(hand));
|
|
|
|
+ if (level().purpurConfig.pigGiveSaddleBack && player.isSecondaryUseActive() && !flag && isSaddled() && !isVehicle()) {
|
|
+ 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;
|
|
+ }
|
|
+
|
|
if (!flag && this.isSaddled() && !this.isVehicle() && !player.isSecondaryUseActive()) {
|
|
if (!this.level().isClientSide) {
|
|
player.startRiding(this);
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index 4d85d928c05d488b5fc6efa96e65a5e31455d261..b5f30231f2b163271e677eaba38154b0e5cfa7ed 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -1003,6 +1003,7 @@ public class PurpurWorldConfig {
|
|
public boolean pigControllable = true;
|
|
public double pigMaxHealth = 10.0D;
|
|
public double pigScale = 1.0D;
|
|
+ public boolean pigGiveSaddleBack = false;
|
|
private void pigSettings() {
|
|
pigRidable = getBoolean("mobs.pig.ridable", pigRidable);
|
|
pigRidableInWater = getBoolean("mobs.pig.ridable-in-water", pigRidableInWater);
|
|
@@ -1014,6 +1015,7 @@ public class PurpurWorldConfig {
|
|
}
|
|
pigMaxHealth = getDouble("mobs.pig.attributes.max_health", pigMaxHealth);
|
|
pigScale = Mth.clamp(getDouble("mobs.pig.attributes.scale", pigScale), 0.0625D, 16.0D);
|
|
+ pigGiveSaddleBack = getBoolean("mobs.pig.give-saddle-back", pigGiveSaddleBack);
|
|
}
|
|
|
|
public boolean piglinRidable = false;
|