mirror of https://github.com/Minestom/Minestom.git
WIP ItemStack#getCustomDisplay
This commit is contained in:
parent
84b74eb45f
commit
c5172a7275
|
@ -111,7 +111,7 @@ public class CollisionUtils {
|
|||
// find the corner which moved the least
|
||||
float smallestDisplacement = Float.POSITIVE_INFINITY;
|
||||
for (int i = 0; i < corners.length; i++) {
|
||||
float displacement = (float) corners[i].distance(cornersCopy[i]);
|
||||
final float displacement = (float) corners[i].distance(cornersCopy[i]);
|
||||
if (displacement < smallestDisplacement) {
|
||||
smallestDisplacement = displacement;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package net.minestom.server.item;
|
||||
|
||||
import net.minestom.server.chat.ColoredText;
|
||||
|
||||
public class ItemDisplay {
|
||||
|
||||
private ColoredText displayName;
|
||||
private ColoredText[] lore;
|
||||
|
||||
public ItemDisplay(ColoredText displayName, ColoredText[] lore) {
|
||||
this.displayName = displayName;
|
||||
this.lore = lore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item display name
|
||||
*
|
||||
* @return the item display name
|
||||
*/
|
||||
public ColoredText getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item lore
|
||||
*
|
||||
* @return the item lore
|
||||
*/
|
||||
public ColoredText[] getLore() {
|
||||
return lore;
|
||||
}
|
||||
}
|
|
@ -618,6 +618,20 @@ public class ItemStack implements DataContainer {
|
|||
return compound;
|
||||
}
|
||||
|
||||
/**
|
||||
* WARNING: not implemented yet
|
||||
* <p>
|
||||
* This is be called each time an item is serialized to be send to a player,
|
||||
* can be used to customize the display of the item based on player data
|
||||
*
|
||||
* @param player the player
|
||||
* @return the custom {@link ItemDisplay} for {@code player},
|
||||
* null to use the normal item display name & lore
|
||||
*/
|
||||
public ItemDisplay getCustomDisplay(Player player) {
|
||||
throw new UnsupportedOperationException("Not implemented yet");
|
||||
}
|
||||
|
||||
// Callback events
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue