geforkt von Mirrors/Paper
71c84c8132
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent 258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD CraftBukkit Changes: 98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent 5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class 76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor Spigot Changes: e9ec5485 Rebuild patches f1b62e0c Rebuild patches
66 Zeilen
3.4 KiB
Diff
66 Zeilen
3.4 KiB
Diff
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/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
|
|
index 6b8d6ae203b7f7f2b591c35586baa4e8951a3677..9b0f54af3160c5756784e31cf1347eb97ca77e47 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
|
|
@@ -61,6 +61,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
|
|
@Nullable
|
|
private BlockPos wanderTarget;
|
|
private int despawnDelay;
|
|
+ // Paper start - Add more WanderingTrader API
|
|
+ public boolean canDrinkPotion = true;
|
|
+ public boolean canDrinkMilk = true;
|
|
+ // Paper end - Add more WanderingTrader API
|
|
|
|
public WanderingTrader(EntityType<? extends WanderingTrader> type, Level world) {
|
|
super(type, world);
|
|
@@ -71,10 +75,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
|
|
protected void registerGoals() {
|
|
this.goalSelector.addGoal(0, new FloatGoal(this));
|
|
this.goalSelector.addGoal(0, new UseItemGoal<>(this, PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEvents.WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> {
|
|
- return this.level().isNight() && !entityvillagertrader.isInvisible();
|
|
+ return this.canDrinkPotion && this.level().isNight() && !entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API
|
|
}));
|
|
this.goalSelector.addGoal(0, new UseItemGoal<>(this, new ItemStack(Items.MILK_BUCKET), SoundEvents.WANDERING_TRADER_REAPPEARED, (entityvillagertrader) -> {
|
|
- return this.level().isDay() && entityvillagertrader.isInvisible();
|
|
+ return this.canDrinkMilk && this.level().isDay() && entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API
|
|
}));
|
|
this.goalSelector.addGoal(1, new TradeWithPlayerGoal(this));
|
|
this.goalSelector.addGoal(1, new AvoidEntityGoal<>(this, Zombie.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 08194a78c2170e971ee8ff440b276ed3590e8c4a..0e597394a3dd08f022614fc9777302fea581eb55 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
|
|
@@ -28,4 +28,26 @@ public class CraftWanderingTrader extends CraftAbstractVillager implements Wande
|
|
public void setDespawnDelay(int despawnDelay) {
|
|
this.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
|
|
}
|