Skip to content

Commit

Permalink
fix items not being able to be placed on ancient altar (#4094)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Walsh <[email protected]>
  • Loading branch information
J3fftw1 and WalshyDev authored Jan 16, 2024
1 parent eb4d23e commit 6bc1b1f
Showing 1 changed file with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import javax.annotation.Nonnull;

import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;

Expand Down Expand Up @@ -47,13 +49,22 @@ public class ArmorStandUtils {
* @return The spawned {@link ArmorStand}
*/
public static @Nonnull ArmorStand spawnArmorStand(@Nonnull Location location) {
return location.getWorld().spawn(location, ArmorStand.class, armorStand -> {
armorStand.setVisible(false);
armorStand.setSilent(true);
armorStand.setMarker(true);
armorStand.setGravity(false);
armorStand.setBasePlate(false);
armorStand.setRemoveWhenFarAway(false);
});
// 1.19 and below don't have the consumer method so flicker exists on these versions.
if (Slimefun.getMinecraftVersion().isBefore(MinecraftVersion.MINECRAFT_1_20)) {
ArmorStand armorStand = location.getWorld().spawn(location, ArmorStand.class);
setupArmorStand(armorStand);
return armorStand;
}

return location.getWorld().spawn(location, ArmorStand.class, armorStand -> setupArmorStand(armorStand));
}

private static void setupArmorStand(ArmorStand armorStand) {
armorStand.setVisible(false);
armorStand.setSilent(true);
armorStand.setMarker(true);
armorStand.setGravity(false);
armorStand.setBasePlate(false);
armorStand.setRemoveWhenFarAway(false);
}
}

0 comments on commit 6bc1b1f

Please sign in to comment.