mirror of
https://github.com/Minestom/Minestom.git
synced 2024-09-28 22:47:41 +02:00
WIP FireworkMeta & ChatHoverEvent cleanup
This commit is contained in:
parent
bf55bf23e7
commit
6cc315fe78
@ -127,7 +127,15 @@ public class ChatHoverEvent {
|
|||||||
JsonObject displayJson = null;
|
JsonObject displayJson = null;
|
||||||
if (itemStack.hasDisplayName() || itemStack.hasLore()) {
|
if (itemStack.hasDisplayName() || itemStack.hasLore()) {
|
||||||
displayJson = new JsonObject();
|
displayJson = new JsonObject();
|
||||||
// TODO: Color (Leather armour)
|
|
||||||
|
// Leather armor
|
||||||
|
{
|
||||||
|
if (hasMeta && itemMeta instanceof LeatherArmorMeta) {
|
||||||
|
final LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) itemMeta;
|
||||||
|
// TODO: Color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (itemStack.hasDisplayName()) {
|
if (itemStack.hasDisplayName()) {
|
||||||
// This is done as this contains a json text component describing the item's name.
|
// This is done as this contains a json text component describing the item's name.
|
||||||
// We replace it in the last step, as adding it now would replace it with lenient JSON which MC doesn't want.
|
// We replace it in the last step, as adding it now would replace it with lenient JSON which MC doesn't want.
|
||||||
@ -147,20 +155,35 @@ public class ChatHoverEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WrittenBooks
|
// WrittenBooks
|
||||||
|
{
|
||||||
|
if (hasMeta && itemMeta instanceof WrittenBookMeta) {
|
||||||
|
final WrittenBookMeta writtenBookMeta = (WrittenBookMeta) itemMeta;
|
||||||
// TODO: Resolved
|
// TODO: Resolved
|
||||||
// TODO: Generation
|
// TODO: Generation
|
||||||
// TODO: Author
|
// TODO: Author
|
||||||
// TODO: Title
|
// TODO: Title
|
||||||
// TODO: Pages
|
// TODO: Pages
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Book and Quills
|
// Book and Quills
|
||||||
|
{
|
||||||
|
if (hasMeta && itemMeta instanceof WritableBookMeta) {
|
||||||
|
final WritableBookMeta writableBookMeta = (WritableBookMeta) itemMeta;
|
||||||
// TODO: Pages
|
// TODO: Pages
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Player Heads
|
// Player Heads
|
||||||
// TODO: Alot check https://minecraft.gamepedia.com/Player.dat_format#Item_structure#Player_Heads
|
// TODO: Alot check https://minecraft.gamepedia.com/Player.dat_format#Item_structure#Player_Heads
|
||||||
|
|
||||||
// Fireworks
|
// Fireworks
|
||||||
|
{
|
||||||
|
if (hasMeta && itemMeta instanceof FireworkMeta) {
|
||||||
|
final FireworkMeta fireworkMeta = (FireworkMeta) itemMeta;
|
||||||
// TODO: Alot check https://minecraft.gamepedia.com/Player.dat_format#Item_structure#Fireworks
|
// TODO: Alot check https://minecraft.gamepedia.com/Player.dat_format#Item_structure#Fireworks
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Armorstands and Spawn Eggs
|
// Armorstands and Spawn Eggs
|
||||||
// TODO: EntityTag
|
// TODO: EntityTag
|
||||||
|
@ -593,6 +593,9 @@ public class ItemStack implements DataContainer {
|
|||||||
if (material == Material.WRITTEN_BOOK)
|
if (material == Material.WRITTEN_BOOK)
|
||||||
return new WrittenBookMeta();
|
return new WrittenBookMeta();
|
||||||
|
|
||||||
|
if (material == Material.FIREWORK_ROCKET)
|
||||||
|
return new FireworkMeta();
|
||||||
|
|
||||||
if (material == Material.LEATHER_HELMET ||
|
if (material == Material.LEATHER_HELMET ||
|
||||||
material == Material.LEATHER_CHESTPLATE ||
|
material == Material.LEATHER_CHESTPLATE ||
|
||||||
material == Material.LEATHER_LEGGINGS ||
|
material == Material.LEATHER_LEGGINGS ||
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
package net.minestom.server.item.metadata;
|
||||||
|
|
||||||
|
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
||||||
|
|
||||||
|
public class FireworkMeta implements ItemMeta {
|
||||||
|
|
||||||
|
private boolean flicker;
|
||||||
|
private boolean trail;
|
||||||
|
private FireworkType type;
|
||||||
|
private int[] colors;
|
||||||
|
private int[] fadeColors;
|
||||||
|
|
||||||
|
private byte flightDuration;
|
||||||
|
// TODO Explosions list
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNbt() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSimilar(ItemMeta itemMeta) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(NBTCompound compound) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(NBTCompound compound) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemMeta clone() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum FireworkType {
|
||||||
|
SMALL_BALL, LARGE_BALL, STAR_SHAPED, CREEPER_SHAPED, BURST
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user