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:
parent
31c7c4ead6
commit
cd3672c3f2
@ -21,6 +21,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.HologramPr
|
|||||||
*/
|
*/
|
||||||
public class ArmorStandUtils {
|
public class ArmorStandUtils {
|
||||||
|
|
||||||
|
private ArmorStandUtils() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spawns an {@link ArmorStand} at the given {@link Location} with the given custom name
|
* Spawns an {@link ArmorStand} at the given {@link Location} with the given custom name
|
||||||
* <br>
|
* <br>
|
||||||
@ -51,15 +53,14 @@ public class ArmorStandUtils {
|
|||||||
// The consumer method was moved from World to RegionAccessor in 1.20.2
|
// 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
|
// 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.
|
// This causes flicker on these versions which sucks but not sure a better way around this right now.
|
||||||
if (PaperLib.getMinecraftVersion() <= 20
|
if (PaperLib.getMinecraftVersion() < 20 ||
|
||||||
&& PaperLib.getMinecraftPatchVersion() < 2
|
(PaperLib.getMinecraftVersion() == 20 && PaperLib.getMinecraftPatchVersion() < 2)) {
|
||||||
) {
|
|
||||||
ArmorStand armorStand = location.getWorld().spawn(location, ArmorStand.class);
|
ArmorStand armorStand = location.getWorld().spawn(location, ArmorStand.class);
|
||||||
setupArmorStand(armorStand);
|
setupArmorStand(armorStand);
|
||||||
return 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) {
|
private static void setupArmorStand(ArmorStand armorStand) {
|
||||||
|
Loading…
Reference in New Issue
Block a user