Files
Purpur/patches/server/0169-Config-to-always-tame-in-Creative.patch
BillyGalbreath 1362f49b24 Updated Upstream (Paper, Tuinity, & Airplane)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
bca97a8f7 replace spaces in world key (touches #5397)
de94f6485 Refactor chat message composition (#5396)
e27f334bb [CI-SKIP] Fix makemcdevsrc.sh for nms relocations (#5389)
ae15e85da Updated Upstream (CraftBukkit)
26fe0ac5a Only set despawnTimer for Wandering Traders spawned by MobSpawnerTrader (#5391)
b748eb7b8 Fix VanillaMobGoalTest#testBukkitMap (#5390)
18dbbb578 [Auto] Updated Upstream (CraftBukkit)
fac9cc5d5 [CI-SKIP] Ignore .gitignore
087aa70e7 Deprecate ItemStack#setLore(List<String>) and ItemStack#getLore, add Component based alternatives
9889c651c apply fixup
c310f0a61 Updated Upstream (Bukkit/CraftBukkit)
f17560ab0 wtf is this t file -jmp
347f3a9b8 fix compile
700e9e6a5 rebase
cf4dc464a Revert de5f4e469...c270abe96
6870db613 script & POM fix
743c6533c Replace ** with * (BSD/macOS)
376d7b097 Don't remove the .java
fcb3fd42a Fix macOS/BSD support
8cfc05249 Link correctly
ba1031ca7 Rename work dir
c8d844ab7 Actually fix preloading this time
e62aa5e3e Fix class preloading
1c03cf898 It's mojang math, not minecraft math
1034873df Apply fixups
39b125771 Use revision file
956150da7 Welcome to 1.16.5-R0.2
ccb217c01 Change cache keys
0d217001c more work
f6d820f07 It compiles
0f78e9525 More work
1718f61bf Updated Upstream (CraftBukkit/Spigot)
b28d46114 Update scripts for NMS repackaging

Tuinity Changes:
9bdcb9b8e Delete work dir when running jar
6351d7ca7 Update Upstream (Paper)
932c199a6 Generate md-dev correctly
bf3e73778 Make packet limiter work from IDE
1686f3861 Fix packet limiter config
f40f7b425 Update README.md styling (#264)
da1c3ace5 GH Actions Changes (#213)
5f325ecf1 Update Upstream (Paper)
0f83fe48d Update Upstream (Paper)

Airplane Changes:
f94d39947 Merge pull request #18 from notOM3GA/upstream/nms-repackage
0fc622631 Force build for Flare update
08439d6a9 Update Upstream (Tuinity)
2021-03-21 23:00:01 -05:00

81 lines
6.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Tue, 9 Feb 2021 21:23:37 -0500
Subject: [PATCH] Config to always tame in Creative
Adds a configuration option that ensures a player in Creative always tames a tameable entity.
This essentially allows Creative mode players to tame animals on their first try.
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java
index d285f5aa66fa81a2f56920c05afb4506cb82fa54..39e348847bcecd91013452e71ef1672994a1bfa7 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java
@@ -63,7 +63,7 @@ public class PathfinderGoalTame extends PathfinderGoal {
int j = this.entity.getMaxDomestication();
// CraftBukkit - fire EntityTameEvent
- if (j > 0 && this.entity.getRandom().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.entity, ((org.bukkit.craftbukkit.entity.CraftHumanEntity) this.entity.getBukkitEntity().getPassenger()).getHandle()).isCancelled()) {
+ if ((this.entity.world.purpurConfig.alwaysTameInCreative && ((EntityHuman) entity).abilities.canInstantlyBuild) || (j > 0 && this.entity.getRandom().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.entity, ((org.bukkit.craftbukkit.entity.CraftHumanEntity) this.entity.getBukkitEntity().getPassenger()).getHandle()).isCancelled())) { // Purpur
this.entity.i((EntityHuman) entity);
return;
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityCat.java b/src/main/java/net/minecraft/world/entity/animal/EntityCat.java
index 7143b0801be7877762e41da336ea5e4e57f2e463..a099d8e0c5a3e4b804c8af978161ec1747ee7fa3 100644
--- a/src/main/java/net/minecraft/world/entity/animal/EntityCat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityCat.java
@@ -439,7 +439,7 @@ public class EntityCat extends EntityTameableAnimal {
}
} else if (this.k(itemstack)) {
this.a(entityhuman, itemstack);
- if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
+ if ((this.world.purpurConfig.alwaysTameInCreative && entityhuman.abilities.canInstantlyBuild) || (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled())) { // CraftBukkit // Purpur
this.tame(entityhuman);
this.setWillSit(true);
this.world.broadcastEntityEffect(this, (byte) 7);
diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java b/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java
index efa4318989893c946e9d7671d0dead6c4a6e315f..b2a8bfc3e53a2071ab7451fbdb3d49d97f0c430a 100644
--- a/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java
@@ -301,7 +301,7 @@ public class EntityParrot extends EntityPerchable implements EntityBird {
}
if (!this.world.isClientSide) {
- if (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
+ if ((this.world.purpurConfig.alwaysTameInCreative && entityhuman.abilities.canInstantlyBuild) || (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled())) { // CraftBukkit // Purpur
this.tame(entityhuman);
this.world.broadcastEntityEffect(this, (byte) 7);
} else {
diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityWolf.java b/src/main/java/net/minecraft/world/entity/animal/EntityWolf.java
index 090903fbc8f6cd1522c7afb358f708f5ae3395f4..884a3f03c73efb8fb0863976615fba5ec10f716c 100644
--- a/src/main/java/net/minecraft/world/entity/animal/EntityWolf.java
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityWolf.java
@@ -482,7 +482,7 @@ public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable
}
// CraftBukkit - added event call and isCancelled check.
- if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
+ if ((this.world.purpurConfig.alwaysTameInCreative && entityhuman.abilities.canInstantlyBuild) || (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled())) { // Purpur
this.tame(entityhuman);
this.navigation.o();
this.setGoalTarget((EntityLiving) null);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 3c0a9b8e71663ad60cf78d4f66f4fd9960f2c59b..b49a909bf1dcf0bebce3eec03b54d05583af2e43 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -255,6 +255,7 @@ public class PurpurWorldConfig {
}
public boolean useBetterMending = false;
+ public boolean alwaysTameInCreative = false;
public boolean boatEjectPlayersOnLand = false;
public boolean boatsDoFallDamage = true;
public boolean disableDropsOnCrammingDeath = false;
@@ -271,6 +272,7 @@ public class PurpurWorldConfig {
public int animalBreedingCooldownSeconds = 0;
private void miscGameplayMechanicsSettings() {
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
+ alwaysTameInCreative = getBoolean("gameplay-mechanics.always-tame-in-creative", alwaysTameInCreative);
boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
boatsDoFallDamage = getBoolean("gameplay-mechanics.boat.do-fall-damage", boatsDoFallDamage);
disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);