mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-20 15:57:49 +01:00
Allow AIR as icon and treat it like other invalid materials
Invalid materials cannot be viewed in the inventory or as Item entity, but can exist as ItemStack. They will be replaced by bedrock
This commit is contained in:
parent
54fede4a72
commit
e4ece4dc80
@ -2,7 +2,6 @@ package com.gmail.filoghost.holographicdisplays.object.line;
|
|||||||
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -37,7 +36,6 @@ public class CraftItemLine extends CraftTouchableLine implements ItemLine {
|
|||||||
@Override
|
@Override
|
||||||
public void setItemStack(ItemStack itemStack) {
|
public void setItemStack(ItemStack itemStack) {
|
||||||
Validator.notNull(itemStack, "itemStack");
|
Validator.notNull(itemStack, "itemStack");
|
||||||
Validator.isTrue(itemStack.getType() != Material.AIR, "itemStack's material cannot be AIR");
|
|
||||||
this.itemStack = itemStack;
|
this.itemStack = itemStack;
|
||||||
|
|
||||||
if (nmsItem != null) {
|
if (nmsItem != null) {
|
||||||
@ -69,8 +67,7 @@ public class CraftItemLine extends CraftTouchableLine implements ItemLine {
|
|||||||
public void spawn(World world, double x, double y, double z) {
|
public void spawn(World world, double x, double y, double z) {
|
||||||
super.spawn(world, x, y, z);
|
super.spawn(world, x, y, z);
|
||||||
|
|
||||||
if (itemStack != null && itemStack.getType() != Material.AIR) {
|
if (itemStack != null) {
|
||||||
|
|
||||||
double offset = getItemOffset();
|
double offset = getItemOffset();
|
||||||
|
|
||||||
nmsItem = HolographicDisplays.getNMSManager().spawnNMSItem(world, x, y + offset, z, this, itemStack, HolographicDisplays.getMainListener());
|
nmsItem = HolographicDisplays.getNMSManager().spawnNMSItem(world, x, y + offset, z, this, itemStack, HolographicDisplays.getMainListener());
|
||||||
|
Loading…
Reference in New Issue
Block a user