forked from mirror/Folia
4a59238743
Very early build, network configuration switching is supported but not tested (note: changes need to be backported to Paper) Changes: - Supports per player mob caps - Adds entity tracker optimisations which are not in Paper (and will not be ported to Paper due to plugin conflicts) - No longer reverts paper distance map optimisations, as those are replaced by the NearbyPlayers class These changes should bring Folia in-line with Paper's optimisations at least (probably more given the entity tracker optimisations), still missing features like world loading / some commands
41 lines
2.8 KiB
Diff
41 lines
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: WillQi <williamqipizza@gmail.com>
|
|
Date: Mon, 15 May 2023 23:45:09 -0600
|
|
Subject: [PATCH] Fix off region raid heroes
|
|
|
|
This patch aims to solve a potential incorrect thread call when completing a raid.
|
|
If a player is a hero of the village but proceeds to leave the region of the
|
|
raid before it's completion, it would throw an exception due to not being on the
|
|
same region thread anymore.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
index 8fc22de1aa17cd8cb52d3804533d56cbb0e6bfeb..49c0f085756889a176684922206b27ca0c660949 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
@@ -410,14 +410,22 @@ public class Raid {
|
|
LivingEntity entityliving = (LivingEntity) entity;
|
|
|
|
if (!entity.isSpectator()) {
|
|
- entityliving.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.badOmenLevel - 1, false, false, true));
|
|
+ //entityliving.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.badOmenLevel - 1, false, false, true)); // Folia - Fix off region raid heroes - move down
|
|
if (entityliving instanceof ServerPlayer) {
|
|
ServerPlayer entityplayer = (ServerPlayer) entityliving;
|
|
|
|
- entityplayer.awardStat(Stats.RAID_WIN);
|
|
- CriteriaTriggers.RAID_WIN.trigger(entityplayer);
|
|
+ // Folia start - Fix off region raid heroes - moved down
|
|
winners.add(entityplayer.getBukkitEntity()); // CraftBukkit
|
|
}
|
|
+ // Folia start - Fix off region raid heroes
|
|
+ entityliving.getBukkitEntity().taskScheduler.schedule((LivingEntity lv) -> {
|
|
+ lv.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.badOmenLevel - 1, false, false, true));
|
|
+ if (lv instanceof ServerPlayer entityplayer) {
|
|
+ entityplayer.awardStat(Stats.RAID_WIN);
|
|
+ CriteriaTriggers.RAID_WIN.trigger(entityplayer);
|
|
+ }
|
|
+ }, null, 1L);
|
|
+ // Folia end - Fix off region raid heroes
|
|
}
|
|
}
|
|
}
|