Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master-1.20-lts' into master-1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Dec 16, 2024
2 parents 742eefe + 482c70d commit b1c7743
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 2 deletions.
5 changes: 5 additions & 0 deletions resources/changelog/1.19.2-1.0.5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
As always, don't forget to backup your world before updating!
Requires CyclopsCore version 1.19.0 or higher.

Fixes:
* Fix NPE in ScriptingData if FileWatcher was not initialized
6 changes: 6 additions & 0 deletions resources/changelog/1.19.2-1.0.6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
As always, don't forget to backup your world before updating!
Requires CyclopsCore version 1.19.0 or higher.

Fixes:
* Fix null object values not being skipped to NBT, Closes #22
* Fix delete not being highlighted as keyword, Closes #23
5 changes: 5 additions & 0 deletions resources/changelog/1.20.1-1.0.5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
As always, don't forget to backup your world before updating!
Requires CyclopsCore version 1.19.0 or higher.

Fixes:
* Fix NPE in ScriptingData if FileWatcher was not initialized
7 changes: 7 additions & 0 deletions resources/changelog/1.20.1-1.0.6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
As always, don't forget to backup your world before updating!
Requires CyclopsCore version 1.19.0 or higher.

Fixes:
* Fix null object values not being skipped to NBT, Closes #22
* Fix delete not being highlighted as keyword, Closes #23
* Fix NPE in ScriptingData if FileWatcher was not initialized
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public LanguageHandlerJavaScript() {
this.tokenStyles = Maps.newHashMap();

this.tokenStyles.put("const", KEYWORD);
this.tokenStyles.put("delete", KEYWORD);
this.tokenStyles.put("let", KEYWORD);
this.tokenStyles.put("var", KEYWORD);
this.tokenStyles.put("function", KEYWORD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@ public ValueTypeNbt.ValueNbt translateFromGraal(Context context, Value value, IE
// In all other cases, assume we have a compound tag
CompoundTag tag = new CompoundTag();
for (String memberKey : value.getMemberKeys()) {
IValue subValue = ValueTranslators.REGISTRY.translateFromGraal(context, value.getMember(memberKey), exceptionFactory, valueDeseralizationContext);
tag.put(memberKey, ValueTranslators.REGISTRY.translateToNbt(context, subValue, exceptionFactory));
Value memberValue = value.getMember(memberKey);
if (!memberValue.isNull()) {
IValue subValue = ValueTranslators.REGISTRY.translateFromGraal(context, memberValue, exceptionFactory, valueDeseralizationContext);
tag.put(memberKey, ValueTranslators.REGISTRY.translateToNbt(context, subValue, exceptionFactory));
}
}
return ValueTypeNbt.ValueNbt.of(tag);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,13 @@ public void testNbtCompound() throws EvaluationException {
assertThat(listValue.getArrayElement(2), equalTo(CTX.asValue(3)));
}

@Test
public void testNbtCompoundWithNullAndUndefined() throws EvaluationException {
CompoundTag compoundTag = new CompoundTag();
compoundTag.put("a", StringTag.valueOf("bla"));
assertThat(ValueTranslators.REGISTRY.translateFromGraal(CTX, getJsValue("exports = { 'a': 'bla', 'b': null, 'c': undefined }"), EF, VDC), equalTo(ValueTypeNbt.ValueNbt.of(compoundTag)));
}

@Test
public void testNbtCompoundBidirectional() throws EvaluationException {
CompoundTag compoundTag = new CompoundTag();
Expand Down

0 comments on commit b1c7743

Please sign in to comment.