Allow Creating Blank Tags
All checks were successful
ScriptCraft/pipeline/head This commit looks good
All checks were successful
ScriptCraft/pipeline/head This commit looks good
This commit is contained in:
parent
d2ba0b6cf2
commit
b9235876b2
@ -6,6 +6,7 @@ import net.minecraft.nbt.AbstractNumberTag;
|
|||||||
import net.minecraft.nbt.ByteTag;
|
import net.minecraft.nbt.ByteTag;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.DoubleTag;
|
import net.minecraft.nbt.DoubleTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.StringTag;
|
import net.minecraft.nbt.StringTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
|
|
||||||
@ -71,5 +72,8 @@ class TagBridges {
|
|||||||
AbstractListTag<?> tag = (AbstractListTag<?>) args[0];
|
AbstractListTag<?> tag = (AbstractListTag<?>) args[0];
|
||||||
return tag.size();
|
return tag.size();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Bridges.addBridge("CompoundTag.create", args -> new CompoundTag());
|
||||||
|
Bridges.addBridge("ListTag.create", args -> new ListTag());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,19 @@ export class CompoundTag {
|
|||||||
keys(): string[] {
|
keys(): string[] {
|
||||||
return useBridge('CompoundTag.keys', this.javaObject) as string[];
|
return useBridge('CompoundTag.keys', this.javaObject) as string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Empty Tag
|
||||||
|
* @returns Empty Tag
|
||||||
|
*/
|
||||||
|
static create(): CompoundTag {
|
||||||
|
const obj = useBridge('CompoundTag.create') as JavaObject;
|
||||||
|
if (obj) {
|
||||||
|
return new CompoundTag(obj);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,4 +116,17 @@ export class ListTag {
|
|||||||
size(): number {
|
size(): number {
|
||||||
return useBridge('ListTag.size', this.javaObject) as number;
|
return useBridge('ListTag.size', this.javaObject) as number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Empty Tag
|
||||||
|
* @returns Empty Tag
|
||||||
|
*/
|
||||||
|
static create(): ListTag {
|
||||||
|
const obj = useBridge('ListTag.create') as JavaObject;
|
||||||
|
if (obj) {
|
||||||
|
return new ListTag(obj);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user