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

fix slimefun blocks turning into vanilla blocks for 1.20.1 and lower (#4105)

This commit is contained in:
J3fftw 2024-01-19 20:57:13 +01:00 committed by GitHub
parent 7c917c396f
commit c95bcc927f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,8 +2,7 @@ package io.github.thebusybiscuit.slimefun4.utils;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; import io.papermc.lib.PaperLib;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
@ -49,8 +48,12 @@ public class ArmorStandUtils {
* @return The spawned {@link ArmorStand} * @return The spawned {@link ArmorStand}
*/ */
public static @Nonnull ArmorStand spawnArmorStand(@Nonnull Location location) { public static @Nonnull ArmorStand spawnArmorStand(@Nonnull Location location) {
// 1.19 and below don't have the consumer method so flicker exists on these versions. // The consumer method was moved from World to RegionAccessor in 1.20.2
if (Slimefun.getMinecraftVersion().isBefore(MinecraftVersion.MINECRAFT_1_20)) { // 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); ArmorStand armorStand = location.getWorld().spawn(location, ArmorStand.class);
setupArmorStand(armorStand); setupArmorStand(armorStand);
return armorStand; return armorStand;