mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Tested!
This commit is contained in:
parent
8795900ec6
commit
bd02eb9570
@ -63,26 +63,21 @@ public class SoulboundRune extends SimpleSlimefunItem<ItemDropHandler> {
|
||||
ItemStack ench = ((Item) entity).getItemStack();
|
||||
Item ent = (Item) entity;
|
||||
|
||||
SlimefunUtils.setSoulbound(ench);
|
||||
|
||||
if (ench.getAmount() == 1) {
|
||||
e.setCancelled(true);
|
||||
|
||||
ItemMeta enchMeta = ench.getItemMeta();
|
||||
|
||||
// This lightning is just an effect, it deals no damage.
|
||||
l.getWorld().strikeLightningEffect(l);
|
||||
|
||||
Slimefun.runSync(() -> {
|
||||
|
||||
// Being sure entities are still valid and not picked up or whatsoever.
|
||||
if (i.isValid() && ent.isValid()) {
|
||||
|
||||
l.getWorld().createExplosion(l, 0.0F);
|
||||
l.getWorld().playSound(l, Sound.ENTITY_GENERIC_EXPLODE, 0.3F, 1F);
|
||||
|
||||
SlimefunUtils.setSoulbound(ench);
|
||||
|
||||
ench.setItemMeta(enchMeta);
|
||||
|
||||
ent.remove();
|
||||
i.remove();
|
||||
l.getWorld().dropItemNaturally(l, ench);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.github.thebusybiscuit.slimefun4.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nonnull;
|
||||
@ -114,7 +115,7 @@ public final class SlimefunUtils {
|
||||
|
||||
public static void setSoulbound(@Nonnull ItemStack item) {
|
||||
final ItemMeta meta = item.getItemMeta();
|
||||
final List<String> lore = meta.getLore();
|
||||
final List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
|
||||
lore.add(SOULBOUND_LORE);
|
||||
meta.setLore(lore);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user