mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
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)
157 lines
6.3 KiB
Diff
157 lines
6.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Fri, 18 Oct 2019 22:50:12 -0500
|
|
Subject: [PATCH] Llama API
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalLlamaFollow.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalLlamaFollow.java
|
|
index 4fd1744f13b87c79ae3f46b28a56daeaba343aa6..34a854131dd939693a6df4d52103714ebe373dc3 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalLlamaFollow.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalLlamaFollow.java
|
|
@@ -11,7 +11,7 @@ import net.minecraft.world.phys.Vec3D;
|
|
|
|
public class PathfinderGoalLlamaFollow extends PathfinderGoal {
|
|
|
|
- public final EntityLlama a;
|
|
+ public final EntityLlama a; public EntityLlama getLlama() { return a; } // Purpur
|
|
private double b;
|
|
private int c;
|
|
|
|
@@ -23,6 +23,7 @@ public class PathfinderGoalLlamaFollow extends PathfinderGoal {
|
|
|
|
@Override
|
|
public boolean a() {
|
|
+ if (!getLlama().shouldJoinCaravan) return false; // Purpur
|
|
if (!this.a.isLeashed() && !this.a.fC()) {
|
|
List<Entity> list = this.a.world.getEntities(this.a, this.a.getBoundingBox().grow(9.0D, 4.0D, 9.0D), (entity) -> {
|
|
EntityTypes<?> entitytypes = entity.getEntityType();
|
|
@@ -82,6 +83,7 @@ public class PathfinderGoalLlamaFollow extends PathfinderGoal {
|
|
|
|
@Override
|
|
public boolean b() {
|
|
+ if (!getLlama().shouldJoinCaravan) return false; // Purpur
|
|
if (this.a.fC() && this.a.fD().isAlive() && this.a(this.a, 0)) {
|
|
double d0 = this.a.h((Entity) this.a.fD());
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java b/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java
|
|
index 2005cb484ba6b5929ad81d3d120521f247f3d4cf..1c6435bf2cd870b795f87368057d8dfc1e1c938a 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java
|
|
@@ -63,7 +63,8 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
|
|
@Nullable
|
|
private EntityLlama bB;
|
|
@Nullable
|
|
- private EntityLlama bC;
|
|
+ private EntityLlama bC; public EntityLlama getCaravanTail() { return bC; } // Purpur - OBFHELPER
|
|
+ public boolean shouldJoinCaravan = true; // Purpur
|
|
|
|
public EntityLlama(EntityTypes<? extends EntityLlama> entitytypes, World world) {
|
|
super(entitytypes, world);
|
|
@@ -92,6 +93,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
|
|
nbttagcompound.set("DecorItem", this.inventoryChest.getItem(1).save(new NBTTagCompound()));
|
|
}
|
|
|
|
+ nbttagcompound.setBoolean("Purpur.ShouldJoinCaravan", shouldJoinCaravan); // Purpur
|
|
}
|
|
|
|
@Override
|
|
@@ -103,6 +105,11 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
|
|
this.inventoryChest.setItem(1, ItemStack.a(nbttagcompound.getCompound("DecorItem")));
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ if (nbttagcompound.hasKey("Purpur.ShouldJoinCaravan")) {
|
|
+ nbttagcompound.setBoolean("Purpur.ShouldJoinCaravan", shouldJoinCaravan);
|
|
+ }
|
|
+ // Purpur end
|
|
this.fe();
|
|
}
|
|
|
|
@@ -437,19 +444,24 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
|
|
}
|
|
}
|
|
|
|
+ public void leaveCaravan() { fA(); } // Purpur - OBFHELPER
|
|
public void fA() {
|
|
if (this.bB != null) {
|
|
+ new net.pl3x.purpur.event.entity.LlamaLeaveCaravanEvent((org.bukkit.entity.Llama) getBukkitEntity()).callEvent(); // Purpur
|
|
this.bB.bC = null;
|
|
}
|
|
|
|
this.bB = null;
|
|
}
|
|
|
|
+ public void joinCaravan(EntityLlama entitiyllama) { a(entitiyllama); } // Purpur - OBFHELPER
|
|
public void a(EntityLlama entityllama) {
|
|
+ if (!shouldJoinCaravan || !new net.pl3x.purpur.event.entity.LlamaJoinCaravanEvent((org.bukkit.entity.Llama) getBukkitEntity(), (org.bukkit.entity.Llama) entityllama.getBukkitEntity()).callEvent()) return; // Purpur
|
|
this.bB = entityllama;
|
|
this.bB.bC = this;
|
|
}
|
|
|
|
+ public boolean hasCaravanTail() { return fB(); } // Purpur - OBFHELPER
|
|
public boolean fB() {
|
|
return this.bC != null;
|
|
}
|
|
@@ -460,7 +472,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
|
|
}
|
|
|
|
@Nullable
|
|
- public EntityLlama fD() {
|
|
+ public EntityLlama fD() { return getCaravanHead(); } public EntityLlama getCaravanHead() { // Purpur - OBFHELPER
|
|
return this.bB;
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
|
index 818034c62893a71808e3af0aa33393605611acdd..71536b6ae6a423e33667efcf584a0020f36fb189 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
|
@@ -66,4 +66,48 @@ public class CraftLlama extends CraftChestedHorse implements Llama, CraftRangedE
|
|
public EntityType getType() {
|
|
return EntityType.LLAMA;
|
|
}
|
|
+
|
|
+ // Purpur start
|
|
+ @Override
|
|
+ public boolean shouldJoinCaravan() {
|
|
+ return getHandle().shouldJoinCaravan;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setShouldJoinCaravan(boolean shouldJoinCaravan) {
|
|
+ getHandle().shouldJoinCaravan = shouldJoinCaravan;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean inCaravan() {
|
|
+ return getHandle().inCaravan();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void joinCaravan(Llama llama) {
|
|
+ if (llama != null) {
|
|
+ getHandle().joinCaravan(((CraftLlama) llama).getHandle());
|
|
+ }
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void leaveCaravan() {
|
|
+ getHandle().leaveCaravan();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean hasCaravanTail() {
|
|
+ return getHandle().hasCaravanTail();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public Llama getCaravanHead() {
|
|
+ return getHandle().getCaravanHead() == null ? null : (Llama) getHandle().getCaravanHead().getBukkitEntity();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public Llama getCaravanTail() {
|
|
+ return getHandle().getCaravanTail() == null ? null : (Llama) getHandle().getCaravanTail().getBukkitEntity();
|
|
+ }
|
|
+ // Purpur end
|
|
}
|