Skip to content

Commit b1c7743

Browse files
committed
Merge remote-tracking branch 'origin/master-1.20-lts' into master-1.21
2 parents 742eefe + 482c70d commit b1c7743

File tree

7 files changed

+36
-2
lines changed

7 files changed

+36
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
As always, don't forget to backup your world before updating!
2+
Requires CyclopsCore version 1.19.0 or higher.
3+
4+
Fixes:
5+
* Fix NPE in ScriptingData if FileWatcher was not initialized
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
As always, don't forget to backup your world before updating!
2+
Requires CyclopsCore version 1.19.0 or higher.
3+
4+
Fixes:
5+
* Fix null object values not being skipped to NBT, Closes #22
6+
* Fix delete not being highlighted as keyword, Closes #23
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
As always, don't forget to backup your world before updating!
2+
Requires CyclopsCore version 1.19.0 or higher.
3+
4+
Fixes:
5+
* Fix NPE in ScriptingData if FileWatcher was not initialized
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
As always, don't forget to backup your world before updating!
2+
Requires CyclopsCore version 1.19.0 or higher.
3+
4+
Fixes:
5+
* Fix null object values not being skipped to NBT, Closes #22
6+
* Fix delete not being highlighted as keyword, Closes #23
7+
* Fix NPE in ScriptingData if FileWatcher was not initialized

src/main/java/org/cyclops/integratedscripting/core/language/LanguageHandlerJavaScript.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public LanguageHandlerJavaScript() {
4242
this.tokenStyles = Maps.newHashMap();
4343

4444
this.tokenStyles.put("const", KEYWORD);
45+
this.tokenStyles.put("delete", KEYWORD);
4546
this.tokenStyles.put("let", KEYWORD);
4647
this.tokenStyles.put("var", KEYWORD);
4748
this.tokenStyles.put("function", KEYWORD);

src/main/java/org/cyclops/integratedscripting/evaluate/translation/translator/ValueTranslatorNbt.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@ public ValueTypeNbt.ValueNbt translateFromGraal(Context context, Value value, IE
123123
// In all other cases, assume we have a compound tag
124124
CompoundTag tag = new CompoundTag();
125125
for (String memberKey : value.getMemberKeys()) {
126-
IValue subValue = ValueTranslators.REGISTRY.translateFromGraal(context, value.getMember(memberKey), exceptionFactory, valueDeseralizationContext);
127-
tag.put(memberKey, ValueTranslators.REGISTRY.translateToNbt(context, subValue, exceptionFactory));
126+
Value memberValue = value.getMember(memberKey);
127+
if (!memberValue.isNull()) {
128+
IValue subValue = ValueTranslators.REGISTRY.translateFromGraal(context, memberValue, exceptionFactory, valueDeseralizationContext);
129+
tag.put(memberKey, ValueTranslators.REGISTRY.translateToNbt(context, subValue, exceptionFactory));
130+
}
128131
}
129132
return ValueTypeNbt.ValueNbt.of(tag);
130133
}

src/test/java/org/cyclops/integratedscripting/evaluate/translation/ValueTranslatorsJavaScriptTests.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,13 @@ public void testNbtCompound() throws EvaluationException {
350350
assertThat(listValue.getArrayElement(2), equalTo(CTX.asValue(3)));
351351
}
352352

353+
@Test
354+
public void testNbtCompoundWithNullAndUndefined() throws EvaluationException {
355+
CompoundTag compoundTag = new CompoundTag();
356+
compoundTag.put("a", StringTag.valueOf("bla"));
357+
assertThat(ValueTranslators.REGISTRY.translateFromGraal(CTX, getJsValue("exports = { 'a': 'bla', 'b': null, 'c': undefined }"), EF, VDC), equalTo(ValueTypeNbt.ValueNbt.of(compoundTag)));
358+
}
359+
353360
@Test
354361
public void testNbtCompoundBidirectional() throws EvaluationException {
355362
CompoundTag compoundTag = new CompoundTag();

0 commit comments

Comments
 (0)