Skip to content

Commit 188654f

Browse files
authored
Merge branch 'Slimefun:master' into master
2 parents 8fdd3da + 6bc1b1f commit 188654f

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import javax.annotation.Nonnull;
44

5+
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
6+
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
57
import org.bukkit.Location;
68
import org.bukkit.entity.ArmorStand;
79

@@ -47,13 +49,22 @@ public class ArmorStandUtils {
4749
* @return The spawned {@link ArmorStand}
4850
*/
4951
public static @Nonnull ArmorStand spawnArmorStand(@Nonnull Location location) {
50-
return location.getWorld().spawn(location, ArmorStand.class, armorStand -> {
51-
armorStand.setVisible(false);
52-
armorStand.setSilent(true);
53-
armorStand.setMarker(true);
54-
armorStand.setGravity(false);
55-
armorStand.setBasePlate(false);
56-
armorStand.setRemoveWhenFarAway(false);
57-
});
52+
// 1.19 and below don't have the consumer method so flicker exists on these versions.
53+
if (Slimefun.getMinecraftVersion().isBefore(MinecraftVersion.MINECRAFT_1_20)) {
54+
ArmorStand armorStand = location.getWorld().spawn(location, ArmorStand.class);
55+
setupArmorStand(armorStand);
56+
return armorStand;
57+
}
58+
59+
return location.getWorld().spawn(location, ArmorStand.class, armorStand -> setupArmorStand(armorStand));
60+
}
61+
62+
private static void setupArmorStand(ArmorStand armorStand) {
63+
armorStand.setVisible(false);
64+
armorStand.setSilent(true);
65+
armorStand.setMarker(true);
66+
armorStand.setGravity(false);
67+
armorStand.setBasePlate(false);
68+
armorStand.setRemoveWhenFarAway(false);
5869
}
5970
}

0 commit comments

Comments
 (0)