From c95bcc927f9720f03f0016bafc24a76848e4f574 Mon Sep 17 00:00:00 2001 From: J3fftw <44972470+J3fftw1@users.noreply.github.com> Date: Fri, 19 Jan 2024 20:57:13 +0100 Subject: [PATCH] fix slimefun blocks turning into vanilla blocks for 1.20.1 and lower (#4105) --- .../slimefun4/utils/ArmorStandUtils.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java index 033e3ca48..5635a040c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java @@ -2,8 +2,7 @@ package io.github.thebusybiscuit.slimefun4.utils; import javax.annotation.Nonnull; -import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; -import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; +import io.papermc.lib.PaperLib; import org.bukkit.Location; import org.bukkit.entity.ArmorStand; @@ -49,8 +48,12 @@ public class ArmorStandUtils { * @return The spawned {@link ArmorStand} */ public static @Nonnull ArmorStand spawnArmorStand(@Nonnull Location location) { - // 1.19 and below don't have the consumer method so flicker exists on these versions. - if (Slimefun.getMinecraftVersion().isBefore(MinecraftVersion.MINECRAFT_1_20)) { + // 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 + ) { ArmorStand armorStand = location.getWorld().spawn(location, ArmorStand.class); setupArmorStand(armorStand); return armorStand;