Skip to content

Commit

Permalink
fix: fix spawn in ArmorStandUtils (#4109)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybw0014 authored Jan 21, 2024
1 parent 31c7c4e commit cd3672c
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*/
public class ArmorStandUtils {

private ArmorStandUtils() {}

/**
* Spawns an {@link ArmorStand} at the given {@link Location} with the given custom name
* <br>
Expand Down Expand Up @@ -51,15 +53,14 @@ public class ArmorStandUtils {
// The consumer method was moved from World to RegionAccessor in 1.20.2
// Due to this, we need to use a rubbish workaround to support 1.20.1 and below
// This causes flicker on these versions which sucks but not sure a better way around this right now.
if (PaperLib.getMinecraftVersion() <= 20
&& PaperLib.getMinecraftPatchVersion() < 2
) {
if (PaperLib.getMinecraftVersion() < 20 ||
(PaperLib.getMinecraftVersion() == 20 && PaperLib.getMinecraftPatchVersion() < 2)) {
ArmorStand armorStand = location.getWorld().spawn(location, ArmorStand.class);
setupArmorStand(armorStand);
return armorStand;
}

return location.getWorld().spawn(location, ArmorStand.class, armorStand -> setupArmorStand(armorStand));
return location.getWorld().spawn(location, ArmorStand.class, ArmorStandUtils::setupArmorStand);
}

private static void setupArmorStand(ArmorStand armorStand) {
Expand Down

0 comments on commit cd3672c

Please sign in to comment.