-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19d8a86
commit e994b61
Showing
26 changed files
with
693 additions
and
363 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
using JSharp; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
|
||
namespace BluePhoenix | ||
{ | ||
public static class JsonMerger | ||
{ | ||
public static JsonElement GetObject(string jsonstring) | ||
{ | ||
jsonstring = Compiler.smartExtract(jsonstring); | ||
|
||
if (jsonstring.StartsWith("{")) | ||
{ | ||
return new JsonObject(jsonstring); | ||
} | ||
if (jsonstring.StartsWith("[")) | ||
{ | ||
return new JsonArray(jsonstring); | ||
} | ||
return new JsonUnit(jsonstring); | ||
} | ||
} | ||
public abstract class JsonElement | ||
{ | ||
public abstract void Merge(JsonElement element, bool keepOld); | ||
} | ||
public class JsonObject: JsonElement | ||
{ | ||
public Dictionary<string, JsonElement> values = new Dictionary<string, JsonElement>(); | ||
|
||
public JsonObject(string element) | ||
{ | ||
string[][] block = Compiler.smartSplit(Compiler.getCodeBlock(element), ',') | ||
.Select(x => Compiler.smartSplitJson(x, ':').Select(y => Compiler.smartExtract(y)).ToArray()) | ||
.ToArray(); | ||
foreach(string[] kv in block) | ||
{ | ||
values[kv[0]] = JsonMerger.GetObject(kv[1]); | ||
} | ||
} | ||
|
||
public override void Merge(JsonElement element, bool keepOld) | ||
{ | ||
JsonObject other = (JsonObject)element; | ||
foreach(string key in other.values.Keys) | ||
{ | ||
if (!values.ContainsKey(key)) | ||
{ | ||
values.Add(key, other.values[key]); | ||
} | ||
else | ||
{ | ||
values[key].Merge(other.values[key], keepOld); | ||
} | ||
} | ||
} | ||
public override string ToString() | ||
{ | ||
if (values.Count > 0) | ||
return "{" + values.Select(x => x.Key.ToString() + ":" + x.Value.ToString()).Aggregate((x, y) => x + ", " + y) + "}"; | ||
else | ||
return "{}"; | ||
} | ||
} | ||
public class JsonArray: JsonElement | ||
{ | ||
public List<JsonElement> elements = new List<JsonElement>(); | ||
|
||
public JsonArray(string element) | ||
{ | ||
string st = Compiler.smartExtract(element); | ||
st = st.Substring(1, st.Length - 2); | ||
elements.AddRange(Compiler.smartSplitJson(st, ',').Select(x => JsonMerger.GetObject(x))); | ||
} | ||
|
||
public override void Merge(JsonElement element, bool keepOld) | ||
{ | ||
elements.AddRange(((JsonArray)element).elements); | ||
} | ||
public override string ToString() | ||
{ | ||
if (elements.Count > 0) | ||
return "[" + elements.Select(x => x.ToString()).Aggregate((x, y) => x + ", " + y) + "]"; | ||
else | ||
return "[]"; | ||
} | ||
} | ||
public class JsonUnit : JsonElement | ||
{ | ||
public string value; | ||
|
||
public JsonUnit(string value){ | ||
this.value = value; | ||
} | ||
|
||
public override void Merge(JsonElement element, bool keepOld) | ||
{ | ||
if (!keepOld) | ||
value = ((JsonUnit)element).value; | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return value; | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"projectName":"effect","datapackDirectory":null,"resourcesPackDirectory":null,"offuscate":true,"isLibrary":true,"description":"","files":[{"name":"import","content":"import standard.java\nimport standard.entity_id\nimport standard.object","index":0},{"name":"effect","content":"package effect\n\nenum(\"effectlist\",\"effectlist\",\"CSV\")\nforgenerate($eff, effectlist){\n lazy clear$eff(){\n /effect clear @s minecraft:$eff\n }\n lazy clear$eff(entity $ent){\n /effect clear $ent minecraft:$eff\n }\n \n lazy $eff(){\n /effect give @s minecraft:$eff 30 0 true\n }\n lazy $eff(int $pow, int $duration){\n require $pow <= 255\n require $pow >= 0\n require $duration <= 1000000\n require $duration >= 0\n /effect give @s minecraft:$eff $pow $duration true\n }\n lazy $eff(int $pow, int $duration, int $particle){\n require $pow <= 255\n require $pow >= 0\n require $duration <= 1000000\n require $duration >= 0\n /effect give @s minecraft:$eff $pow $duration $particle\n }\n \n lazy $eff(entity $ent){\n /effect give $ent minecraft:$eff 30 0 true\n }\n lazy $eff(entity $ent, int $pow, int $duration){\n require $pow <= 255\n require $pow >= 0\n require $duration <= 1000000\n require $duration >= 0\n /effect give $ent minecraft:$eff $pow $duration true\n }\n lazy $eff(entity $ent, int $pow, int $duration, int $particle){\n require $pow <= 255\n require $pow >= 0\n require $duration <= 1000000\n require $duration >= 0\n /effect give $ent minecraft:$eff $pow $duration $particle\n }\n}","index":0}],"resources":[{"name":"effectlist","content":"name\nabsorption\nunluck\nbad_omen\nblindness\nconduit_power\ndolphins_grace\nfire_resistance\nglowing\nhaste\nhealth_boost\nhero_of_the_village\nhunger\ninstant_damage\ninstant_health\ninvisibility\njump_boost\nlevitation\nluck\nmining_fatigue\nnausea\nnight_vision\npoison\nregeneration\nresistance\nsaturation\nslow_falling\nslowness\nspeed\nstrength\nwater_breathing\nweakness\nwither","index":0}],"TagsList":{"blocks":{},"functions":{}},"mcTagsList":{"blocks":{},"functions":{"load":{"values":["load"]},"tick":{"values":["main"]}}},"compileOrder":[],"version":{"major":1,"minor":0,"patch":0,"build":0},"compilationSetting":{"TreeMaxSize":20,"FloatPrecision":1000,"removeUselessFile":true,"offuscate":true,"scoreboardValue":"tbms.value","scoreboardConst":"tbms.const","scoreboardTmp":"tbms.tmp","tagsFolder":true,"forcedOffuscation":{},"libraryFolder":["./lib/1_17/","./lib/1_16_5/","./lib/shared/"],"MCVersion":"1.16.5","ExportAsZip":false,"packformat":6,"rppackformat":7,"CompilerCoreName":"java","Authors":"","generateMAPSFile":true,"generateREADMEFile":true,"opti_FunctionTagsReplace":true,"opti_ExportComment":false,"opti_ShowException":true,"opti_ShowDebug":true,"advanced_debug":false,"isLibrary":false}} | ||
{"projectName":"effect","datapackDirectory":null,"resourcesPackDirectory":null,"offuscate":true,"isLibrary":true,"description":"","files":[{"name":"import","content":"import standard.java\nimport standard.entity_id\nimport standard.object","index":0},{"name":"effect","content":"package effect\n\nenum(\"effectlist\",\"effectlist\",\"CSV\")\nforgenerate($eff, effectlist){\n lazy clear$eff(){\n /effect clear @s minecraft:$eff\n }\n lazy clear$eff(entity $ent){\n /effect clear $ent minecraft:$eff\n }\n \n lazy $eff(){\n /effect give @s minecraft:$eff 30 0 true\n }\n lazy $eff(int $duration, int $pow){\n require $pow <= 255\n require $pow >= 0\n require $duration <= 1000000\n require $duration >= 0\n /effect give @s minecraft:$duration $pow $pow true\n }\n lazy $eff(int $duration, int $pow, int $particle){\n require $pow <= 255\n require $pow >= 0\n require $duration <= 1000000\n require $duration >= 0\n /effect give @s minecraft:$eff $duration $pow $particle\n }\n \n lazy $eff(entity $ent){\n /effect give $ent minecraft:$eff 30 0 true\n }\n lazy $eff(entity $ent, int $duration, int $pow){\n require $pow <= 255\n require $pow >= 0\n require $duration <= 1000000\n require $duration >= 0\n /effect give $ent minecraft:$eff $duration $pow true\n }\n lazy $eff(entity $ent, int $duration, int $pow, int $particle){\n require $pow <= 255\n require $pow >= 0\n require $duration <= 1000000\n require $duration >= 0\n /effect give $ent minecraft:$eff $duration $pow $particle\n }\n}","index":0}],"resources":[{"name":"effectlist","content":"name\nabsorption\nunluck\nbad_omen\nblindness\nconduit_power\ndolphins_grace\nfire_resistance\nglowing\nhaste\nhealth_boost\nhero_of_the_village\nhunger\ninstant_damage\ninstant_health\ninvisibility\njump_boost\nlevitation\nluck\nmining_fatigue\nnausea\nnight_vision\npoison\nregeneration\nresistance\nsaturation\nslow_falling\nslowness\nspeed\nstrength\nwater_breathing\nweakness\nwither","index":0}],"TagsList":{"blocks":{},"functions":{}},"mcTagsList":{"blocks":{},"functions":{"load":{"values":["load"]},"tick":{"values":["main"]}}},"compileOrder":[],"version":{"major":1,"minor":0,"patch":0,"build":1},"compilationSetting":{"TreeMaxSize":20,"FloatPrecision":1000,"removeUselessFile":true,"offuscate":true,"scoreboardValue":"tbms.value","scoreboardConst":"tbms.const","scoreboardTmp":"tbms.tmp","tagsFolder":true,"forcedOffuscation":{},"libraryFolder":["./lib/1_17/","./lib/1_16_5/","./lib/shared/"],"MCVersion":"1.16.5","ExportAsZip":false,"packformat":6,"rppackformat":7,"CompilerCoreName":"java","Authors":"","generateMAPSFile":true,"generateREADMEFile":true,"opti_FunctionTagsReplace":true,"opti_ExportComment":false,"opti_ShowException":true,"opti_ShowDebug":true,"advanced_debug":false,"isLibrary":false}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"projectName":"music","datapackDirectory":null,"resourcesPackDirectory":null,"offuscate":true,"isLibrary":true,"description":"Made With BluePhoenix","files":[{"name":"import","content":"import standard.java\r\nimport standard.entity_id\r\n","index":0},{"name":"music","content":"package music\r\n\r\nenum track = none\r\nTRACK currTrack\r\nINT MusicTick\r\nBOOL Intro\r\n\r\n[inplace]\r\ndef lazy addMusic(int $name,int $file, int $length){\r\n enum track = $name\r\n def play$name(){\r\n currTrack = $name\r\n MusicTick = 10000000\r\n }\r\n def @music_track music$name(){\r\n if (currTrack == $name && MusicTick >= $length){\r\n /playsound $file record @s ~ ~ ~ 1\r\n MusicTick = 0\r\n }\r\n }\r\n}\r\n\r\n[inplace]\r\ndef lazy addMusic(int $name,int $file_intro, int $file_loop, int $length_intro, int $length_loop){\r\n enum track = $name\r\n def play$name(){\r\n currTrack = $name\r\n MusicTick = 0\r\n /playsound $file_intro record @s ~ ~ ~ 1\r\n Intro = true\r\n }\r\n def @music_track music$name(){\r\n if (currTrack == $name && MusicTick >= $length_loop && !Intro){\r\n /playsound $file_loop record @s ~ ~ ~ 1\r\n MusicTick = 0\r\n }\r\n if (currTrack == $name && MusicTick >= $length_intro && Intro){\r\n /playsound $file_loop record @s ~ ~ ~ 1\r\n MusicTick = 0\r\n Intro = false\r\n }\r\n }\r\n}\r\n\r\ndef ticking music(){\r\n with(@a,true){\r\n MusicTick++\r\n @music_track()\r\n }\r\n}\r\n\r\ndef stop(){\r\n MusicTick = -10000000\r\n /stopsound @s record\r\n}\r\n\r\ndef continue(){\r\n MusicTick = 10000000\r\n}","index":0}],"resources":[],"TagsList":{"blocks":{},"functions":{}},"mcTagsList":{"blocks":{},"functions":{"load":{"values":["load"]},"tick":{"values":["main"]}}},"compileOrder":[],"version":{"major":1,"minor":0,"patch":0,"build":5},"compilationSetting":{"TreeMaxSize":20,"FloatPrecision":1000,"removeUselessFile":true,"offuscate":true,"scoreboardValue":"tbms.value","scoreboardConst":"tbms.const","scoreboardTmp":"tbms.tmp","tagsFolder":true,"forcedOffuscation":{},"libraryFolder":["./lib/1_16_5/","./lib/shared/"],"MCVersion":"1.16.5","ExportAsZip":false,"packformat":6,"rppackformat":7,"CompilerCoreName":"java","Authors":"","generateMAPSFile":true,"generateREADMEFile":true,"opti_FunctionTagsReplace":true,"opti_ExportComment":false,"opti_ShowException":true,"opti_ShowDebug":true,"advanced_debug":false,"isLibrary":false}} | ||
{"projectName":"music","datapackDirectory":null,"resourcesPackDirectory":null,"offuscate":true,"isLibrary":true,"description":"Made With BluePhoenix","files":[{"name":"import","content":"import standard.java\nimport standard.entity_id\n","index":0},{"name":"music","content":"package music\n\nenum track = none\nTRACK currTrack\nINT MusicTick\nBOOL Intro\n\n[inplace]\ndef lazy addMusic(int $name,int $file, int $length){\n enum track = $name\n def play$name(){\n currTrack = $name\n MusicTick = 10000000\n }\n def @music_track music$name(){\n if (currTrack == $name && MusicTick >= $length){\n /stopsound @s record\n /playsound $file record @s ~ ~ ~ 1\n MusicTick = 0\n }\n }\n}\n\n[inplace]\ndef lazy addMusic(int $name,int $file_intro, int $file_loop, int $length_intro, int $length_loop){\n enum track = $name\n def play$name(){\n if (currTrack != $name){\n currTrack = $name\n MusicTick = 0\n /stopsound @s record\n /playsound $file_intro record @s ~ ~ ~ 1\n Intro = true\n }\n }\n def @music_track music$name(){\n if (currTrack == $name && MusicTick >= $length_loop && !Intro){\n /stopsound @s record\n /playsound $file_loop record @s ~ ~ ~ 1\n MusicTick = 0\n }\n if (currTrack == $name && MusicTick >= $length_intro && Intro){\n /stopsound @s record\n /playsound $file_loop record @s ~ ~ ~ 1\n MusicTick = 0\n Intro = false\n }\n }\n}\n\ndef ticking music(){\n with(@a,true){\n MusicTick++\n @music_track()\n }\n}\n\ndef stop(){\n MusicTick = -10000000\n /stopsound @s record\n}\n\ndef continue(){\n MusicTick = 10000000\n}","index":0}],"resources":[],"TagsList":{"blocks":{},"functions":{}},"mcTagsList":{"blocks":{},"functions":{"load":{"values":["load"]},"tick":{"values":["main"]}}},"compileOrder":[],"version":{"major":1,"minor":0,"patch":0,"build":7},"compilationSetting":{"TreeMaxSize":20,"FloatPrecision":1000,"removeUselessFile":true,"offuscate":true,"scoreboardValue":"tbms.value","scoreboardConst":"tbms.const","scoreboardTmp":"tbms.tmp","tagsFolder":true,"forcedOffuscation":{},"libraryFolder":["./lib/1_16_5/","./lib/shared/"],"MCVersion":"1.16.5","ExportAsZip":false,"packformat":6,"rppackformat":7,"CompilerCoreName":"java","Authors":"","generateMAPSFile":true,"generateREADMEFile":true,"opti_FunctionTagsReplace":true,"opti_ExportComment":false,"opti_ShowException":true,"opti_ShowDebug":true,"advanced_debug":false,"isLibrary":false}} |
Oops, something went wrong.