I think I know what you’re trying to get at, but that format seems to be fail on a few levels. I can try something else that might be what you mean. Show result of get display name from stack, offer displayname back, show result display name, offer that back again… or do you mean to serialize it with stuff like configurate things and data-holder outputs?
ItemStack ingredient = ItemStack.builder()
.itemType(ItemTypes.STONE)
.keyValue(Keys.STONE_TYPE, StoneTypes.GRANITE)
.keyValue(Keys.DISPLAY_NAME, ingredientName)
.build();
System.out.println("Getting from build0: " + ingredient.get(Keys.DISPLAY_NAME).get().toString());
System.out.println(ingredient.offer(Keys.DISPLAY_NAME, ingredient.get(Keys.DISPLAY_NAME).get()));
System.out.println("Getting from offer1: " + ingredient.get(Keys.DISPLAY_NAME).get().toString());
System.out.println(ingredient.offer(Keys.DISPLAY_NAME, ingredient.get(Keys.DISPLAY_NAME).get()));
System.out.println("Getting from offer2: " + ingredient.get(Keys.DISPLAY_NAME).get().toString());
System.out.println(ingredient.offer(Keys.DISPLAY_NAME, ingredient.get(Keys.DISPLAY_NAME).get()));
System.out.println(ingredient.get(Keys.DISPLAY_NAME));
Its not burying the text as a child inception-style. For the purposes of this test, getting the ingredientname back from the stack after setting it on the stack would seem the solution for this class. Initialize with the desired text object, assign to stack, then reset it to the get displayname value…
[08:48:33 INFO] [STDOUT]: Getting from build0: Text{children=[Text{format=TextFormat{color=white, style=TextStyle{}}, Copper Ore}], }
[08:48:33 INFO] [STDOUT]: DataTransactionResult{resultType=SUCCESS, rejectedData=[], replacedData=[ImmutableSpongeValue{key=Key{Value:Value<Text>, Query: DisplayName}, default
Value=Text{}, actualValue=Text{children=[Text{format=TextFormat{color=white, style=TextStyle{}}, Copper Ore}], }}], successfulData=[ImmutableSpongeValue{key=Key{Value:Value<Text>, Query: DisplayName}, defaultValue=Text{}, actualValue=Text{children=[Text{format=TextFormat{color=white, style=TextStyle{}}, Copper Ore}], }}]}
[08:48:33 INFO] [STDOUT]: Getting from offer1: Text{children=[Text{format=TextFormat{color=white, style=TextStyle{}}, Copper Ore}], }
[08:48:33 INFO] [STDOUT]: DataTransactionResult{resultType=SUCCESS, rejectedData=[], replacedData=[ImmutableSpongeValue{key=Key{Value:Value<Text>, Query: DisplayName}, default
Value=Text{}, actualValue=Text{children=[Text{format=TextFormat{color=white, style=TextStyle{}}, Copper Ore}], }}], successfulData=[ImmutableSpongeValue{key=Key{Value:Value<Text>, Query: DisplayName}, defaultValue=Text{}, actualValue=Text{children=[Text{format=TextFormat{color=white, style=TextStyle{}}, Copper Ore}], }}]}
[08:48:33 INFO] [STDOUT]: Getting from offer2: Text{children=[Text{format=TextFormat{color=white, style=TextStyle{}}, Copper Ore}], }
[08:48:33 INFO] [STDOUT]: DataTransactionResult{resultType=SUCCESS, rejectedData=[], replacedData=[ImmutableSpongeValue{key=Key{Value:Value<Text>, Query: DisplayName}, default
Value=Text{}, actualValue=Text{children=[Text{format=TextFormat{color=white, style=TextStyle{}}, Copper Ore}], }}], successfulData=[ImmutableSpongeValue{key=Key{Value:Value<Text>, Query: DisplayName}, defaultValue=Text{}, actualValue=Text{children=[Text{format=TextFormat{color=white, style=TextStyle{}}, Copper Ore}], }}]}
[08:48:33 INFO] [STDOUT]: Optional[Text{children=[Text{format=TextFormat{color=white, style=TextStyle{}}, Copper Ore}], }]
Still, none of this helps with the sad fact that the system seems to be ignoring the isValid false return value