use of com.laytonsmith.abstraction.MCItemStack in project CommandHelper by EngineHub.
the class BukkitMCWorld method spawnParticle.
@Override
public void spawnParticle(MCLocation l, MCParticle pa, int count, double offsetX, double offsetY, double offsetZ, double velocity, Object data) {
try {
Particle type = Particle.valueOf(pa.name());
Location loc = ((BukkitMCLocation) l).asLocation();
if (data != null && type.getDataType().equals(ItemStack.class) && data instanceof MCItemStack) {
w.spawnParticle(type, loc, count, offsetX, offsetY, offsetZ, velocity, ((MCItemStack) data).getHandle());
} else {
w.spawnParticle(type, loc, count, offsetX, offsetY, offsetZ, velocity);
}
} catch (NoClassDefFoundError ex) {
// probably prior to 1.9
}
}
use of com.laytonsmith.abstraction.MCItemStack in project CommandHelper by EngineHub.
the class BukkitMCInventory method addItem.
@Override
public Map<Integer, MCItemStack> addItem(MCItemStack stack) {
Map<Integer, ItemStack> h = i.addItem(stack == null ? null : ((BukkitMCItemStack) stack).is);
Map<Integer, MCItemStack> m = new HashMap<>();
for (Map.Entry<Integer, ItemStack> entry : h.entrySet()) {
Integer key = entry.getKey();
ItemStack value = entry.getValue();
m.put(key, new BukkitMCItemStack(value));
}
return m;
}
use of com.laytonsmith.abstraction.MCItemStack in project CommandHelper by EngineHub.
the class BukkitMCItemFactory method asMetaFor.
@Override
public MCItemMeta asMetaFor(MCItemMeta meta, MCItemStack stack) {
ItemMeta bmeta = ((BukkitMCItemMeta) meta).asItemMeta();
ItemStack bstack = ((BukkitMCItemStack) stack).asItemStack();
return BukkitConvertor.BukkitGetCorrectMeta(f.asMetaFor(bmeta, bstack));
}
use of com.laytonsmith.abstraction.MCItemStack in project CommandHelper by EngineHub.
the class BukkitMCPlayer method spawnParticle.
@Override
public void spawnParticle(MCLocation l, MCParticle pa, int count, double offsetX, double offsetY, double offsetZ, double velocity, Object data) {
try {
Particle type = Particle.valueOf(pa.name());
Location loc = ((BukkitMCLocation) l).asLocation();
if (data != null && type.getDataType().equals(ItemStack.class) && data instanceof MCItemStack) {
p.spawnParticle(type, loc, count, offsetX, offsetY, offsetZ, velocity, ((MCItemStack) data).getHandle());
} else {
p.spawnParticle(type, loc, count, offsetX, offsetY, offsetZ, velocity);
}
} catch (NoClassDefFoundError ex) {
// probably prior to 1.9
}
}
use of com.laytonsmith.abstraction.MCItemStack in project CommandHelper by EngineHub.
the class BukkitMCItemFactory method isApplicable.
@Override
public boolean isApplicable(MCItemMeta meta, MCItemStack stack) {
ItemMeta bmeta = ((BukkitMCItemMeta) meta).asItemMeta();
ItemStack bstack = ((BukkitMCItemStack) stack).asItemStack();
return f.isApplicable(bmeta, bstack);
}
Aggregations