1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

fix: fix spawn in ArmorStandUtils (#4109)

This commit is contained in:
ybw0014 2024-01-21 09:49:07 -05:00 committed by GitHub
parent 31c7c4ead6
commit cd3672c3f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.HologramPr
*/
public class ArmorStandUtils {
private ArmorStandUtils() {}
/**
* Spawns an {@link ArmorStand} at the given {@link Location} with the given custom name
* <br>
@ -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) {