mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 09:57:43 +01:00
100/310
This commit is contained in:
48
patches/server/0034-Pigs-give-saddle-back.patch
Normal file
48
patches/server/0034-Pigs-give-saddle-back.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
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 29f11d780c0e56fe69c05d95cbab6004d0c35a86..978d4e1816e1f7fb55ae69e4cb272740e095f711 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Pig.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Pig.java
|
||||
@@ -156,6 +156,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 c9a48e01a63ccefa152b5ae13a8b5f40337a69b5..37ac816a50cd01fe82bdbbd68560e52fc4ce289c 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -661,6 +661,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public double pigMaxHealth = 10.0D;
|
||||
+ public boolean pigGiveSaddleBack = false;
|
||||
private void pigSettings() {
|
||||
if (PurpurConfig.version < 10) {
|
||||
double oldValue = getDouble("mobs.pig.attributes.max-health", pigMaxHealth);
|
||||
@@ -668,6 +669,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 double piglinMaxHealth = 16.0D;
|
||||
Reference in New Issue
Block a user