mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Merge pull request #3923 from JustAHuman-xD/fix/not-caught-versioning-ancient-pedestal-error
Patch for #3922
This commit is contained in:
commit
ca85798b0b
@ -94,7 +94,7 @@ public class AncientPedestal extends SimpleSlimefunItem<BlockDispenseHandler> im
|
|||||||
public @Nonnull Optional<Item> getPlacedItem(@Nonnull Block pedestal) {
|
public @Nonnull Optional<Item> getPlacedItem(@Nonnull Block pedestal) {
|
||||||
Location l = pedestal.getLocation().add(0.5, 1.2, 0.5);
|
Location l = pedestal.getLocation().add(0.5, 1.2, 0.5);
|
||||||
|
|
||||||
for (Entity n : l.getWorld().getNearbyEntities(l, 0.5, 0.5, 0.5, this::testItem)) {
|
for (Entity n : l.getWorld().getNearbyEntities(l, 0.5, 0.5, 0.5, AncientPedestal::testItem)) {
|
||||||
if (n instanceof Item item) {
|
if (n instanceof Item item) {
|
||||||
return Optional.of(item);
|
return Optional.of(item);
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ public class AncientPedestal extends SimpleSlimefunItem<BlockDispenseHandler> im
|
|||||||
return createIfNoneExists ? ArmorStandUtils.spawnArmorStand(l) : null;
|
return createIfNoneExists ? ArmorStandUtils.spawnArmorStand(l) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean testItem(@Nullable Entity n) {
|
public static boolean testItem(@Nullable Entity n) {
|
||||||
if (n instanceof Item item && n.isValid()) {
|
if (n instanceof Item item && n.isValid()) {
|
||||||
ItemMeta meta = item.getItemStack().getItemMeta();
|
ItemMeta meta = item.getItemStack().getItemMeta();
|
||||||
|
|
||||||
@ -172,7 +172,6 @@ public class AncientPedestal extends SimpleSlimefunItem<BlockDispenseHandler> im
|
|||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
ArmorStand armorStand = getArmorStand(b, true);
|
ArmorStand armorStand = getArmorStand(b, true);
|
||||||
entity.setInvulnerable(true);
|
entity.setInvulnerable(true);
|
||||||
entity.setUnlimitedLifetime(true);
|
|
||||||
entity.setVelocity(new Vector(0, 0.1, 0));
|
entity.setVelocity(new Vector(0, 0.1, 0));
|
||||||
entity.setCustomNameVisible(true);
|
entity.setCustomNameVisible(true);
|
||||||
entity.setCustomName(nametag);
|
entity.setCustomName(nametag);
|
||||||
|
@ -24,6 +24,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import io.github.bakedlibs.dough.items.CustomItemStack;
|
import io.github.bakedlibs.dough.items.CustomItemStack;
|
||||||
@ -357,4 +358,10 @@ public class AncientAltarListener implements Listener {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
|
public void onItemDespawn(ItemDespawnEvent e) {
|
||||||
|
if (AncientPedestal.testItem(e.getEntity())) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user