geforkt von Mirrors/Paper
Add more Wandering Trader API (#5020)
Dieser Commit ist enthalten in:
Ursprung
62edbcf9db
Commit
28d6fe5def
41
Spigot-API-Patches/Add-more-WanderingTrader-API.patch
Normale Datei
41
Spigot-API-Patches/Add-more-WanderingTrader-API.patch
Normale Datei
@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: HexedHero <6012891+HexedHero@users.noreply.github.com>
|
||||
Date: Thu, 6 May 2021 14:56:26 +0100
|
||||
Subject: [PATCH] Add more WanderingTrader API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/WanderingTrader.java b/src/main/java/org/bukkit/entity/WanderingTrader.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/WanderingTrader.java
|
||||
+++ b/src/main/java/org/bukkit/entity/WanderingTrader.java
|
||||
@@ -0,0 +0,0 @@ public interface WanderingTrader extends AbstractVillager {
|
||||
* {@link WanderingTrader} is forcibly despawned
|
||||
*/
|
||||
public void setDespawnDelay(int despawnDelay);
|
||||
+
|
||||
+ // Paper start - Add more WanderingTrader API
|
||||
+ /**
|
||||
+ * Set if the Wandering Trader can and will drink an invisibility potion.
|
||||
+ * @param bool whether the mob will drink
|
||||
+ */
|
||||
+ public void setCanDrinkPotion(boolean bool);
|
||||
+
|
||||
+ /**
|
||||
+ * Get if the Wandering Trader can and will drink an invisibility potion.
|
||||
+ * @return whether the mob will drink
|
||||
+ */
|
||||
+ public boolean canDrinkPotion();
|
||||
+
|
||||
+ /**
|
||||
+ * Set if the Wandering Trader can and will drink milk.
|
||||
+ * @param bool whether the mob will drink
|
||||
+ */
|
||||
+ public void setCanDrinkMilk(boolean bool);
|
||||
+
|
||||
+ /**
|
||||
+ * Get if the Wandering Trader can and will drink milk.
|
||||
+ * @return whether the mob will drink
|
||||
+ */
|
||||
+ public boolean canDrinkMilk();
|
||||
+ // Paper end
|
||||
}
|
65
Spigot-Server-Patches/Add-more-WanderingTrader-API.patch
Normale Datei
65
Spigot-Server-Patches/Add-more-WanderingTrader-API.patch
Normale Datei
@ -0,0 +1,65 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: HexedHero <6012891+HexedHero@users.noreply.github.com>
|
||||
Date: Thu, 6 May 2021 14:56:43 +0100
|
||||
Subject: [PATCH] Add more WanderingTrader API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java
|
||||
@@ -0,0 +0,0 @@ public class EntityVillagerTrader extends EntityVillagerAbstract {
|
||||
@Nullable
|
||||
private BlockPosition bp;
|
||||
private int despawnDelay;
|
||||
+ // Paper start - Add more WanderingTrader API
|
||||
+ public boolean canDrinkPotion = true;
|
||||
+ public boolean canDrinkMilk = true;
|
||||
+ // Paper end
|
||||
|
||||
public EntityVillagerTrader(EntityTypes<? extends EntityVillagerTrader> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -0,0 +0,0 @@ public class EntityVillagerTrader extends EntityVillagerAbstract {
|
||||
protected void initPathfinder() {
|
||||
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||
this.goalSelector.a(0, new PathfinderGoalUseItem<>(this, PotionUtil.a(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEffects.ENTITY_WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> {
|
||||
- return this.world.isNight() && !entityvillagertrader.isInvisible();
|
||||
+ return canDrinkPotion && this.world.isNight() && !entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API
|
||||
}));
|
||||
this.goalSelector.a(0, new PathfinderGoalUseItem<>(this, new ItemStack(Items.MILK_BUCKET), SoundEffects.ENTITY_WANDERING_TRADER_REAPPEARED, (entityvillagertrader) -> {
|
||||
- return this.world.isDay() && entityvillagertrader.isInvisible();
|
||||
+ return canDrinkMilk && this.world.isDay() && entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API
|
||||
}));
|
||||
this.goalSelector.a(1, new PathfinderGoalTradeWithPlayer(this));
|
||||
this.goalSelector.a(1, new PathfinderGoalAvoidTarget<>(this, EntityZombie.class, 8.0F, 0.5D, 0.5D));
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWanderingTrader extends CraftAbstractVillager implements Wande
|
||||
public void setDespawnDelay(int despawnDelay) {
|
||||
getHandle().setDespawnDelay(despawnDelay);
|
||||
}
|
||||
+
|
||||
+ // Paper start - Add more WanderingTrader API
|
||||
+ @Override
|
||||
+ public void setCanDrinkPotion(boolean bool) {
|
||||
+ getHandle().canDrinkPotion = bool;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canDrinkPotion() {
|
||||
+ return getHandle().canDrinkPotion;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCanDrinkMilk(boolean bool) {
|
||||
+ getHandle().canDrinkMilk = bool;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canDrinkMilk() {
|
||||
+ return getHandle().canDrinkMilk;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren