@Override public JsonElement serialize(WrappedBlockData src, Type typeOfSrc, JsonSerializationContext context) { JsonObject obj = new JsonObject(); obj.addProperty("type", src.getType().name()); obj.addProperty("data", src.getData()); return obj; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + getType().hashCode(); result = prime * result + getData(); return result; }
@Override public ItemStack getItemInMainHand() { Optional<WrappedBlockData> value = getData(MetaIndex.ENDERMAN_ITEM); if (value.isPresent()) { WrappedBlockData pair = value.get(); Material id = pair.getType(); int data = pair.getData(); return new ItemStack(id, 1, (short) data); } else { return null; } }