-
Notifications
You must be signed in to change notification settings - Fork 13
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
Showing
84 changed files
with
449 additions
and
189 deletions.
There are no files selected for viewing
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
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
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
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 @@ | ||
execute anchored eyes positioned ^ ^ ^ anchored feet run function mypack:objd/ray1 |
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,6 @@ | ||
# Generated ray1 Group Widget from main | ||
say Hi | ||
execute unless block ~ ~ ~ minecraft:air run tag @s add objd_ray_hit | ||
execute unless entity @s[tag=objd_ray_hit] positioned ^ ^ ^0.25 run function mypack:objd/ray1 | ||
execute if entity @s[tag=objd_ray_hit] run function mypack:objd/rayhit1 | ||
execute if entity @s[tag=objd_ray_hit] run tag @s remove objd_ray_hit |
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,2 @@ | ||
# This is the raycast result from your raycast widget in main | ||
say Hi |
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 @@ | ||
{"name":"folder name","path":"./","packs":[{"name":"mypack","files":{"main":[],"load":[]},"main":"main","load":"load"}],"description":"This is a datapack generated with objd by Stevertus"} | ||
{"name":"folder name","path":"./","packs":[{"name":"mypack","files":{"main":["execute anchored eyes positioned ^ ^ ^ anchored feet run function mypack:objd/ray1"],"load":[],"objd/ray1":["# Generated ray1 Group Widget from main","say Hi","execute unless block ~ ~ ~ minecraft:air run tag @s add objd_ray_hit","execute unless entity @s[tag=objd_ray_hit] positioned ^ ^ ^0.25 run function mypack:objd/ray1","execute if entity @s[tag=objd_ray_hit] run function mypack:objd/rayhit1","execute if entity @s[tag=objd_ray_hit] run tag @s remove objd_ray_hit"],"objd/rayhit1":["# This is the raycast result from your raycast widget in main","say Hi"]},"main":"main","load":"load"}],"description":"This is a datapack generated with objd by Stevertus"} |
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
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
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,55 @@ | ||
import 'package:objd/core.dart'; | ||
|
||
/// The ClickEvent Module uses the trigger of a carrot on a stick to register right clicks with a scoreboard and execute a [onClick] Widget. | ||
class ClickEvent extends Module { | ||
String path; | ||
String name; | ||
Widget onClick; | ||
Item selectedItem; | ||
Score _score = Score.fromSelected("objd_click"); | ||
/// The ClickEvent Module uses the trigger of a carrot on a stick to register right clicks with a scoreboard and execute a [onClick] Widget. | ||
/// | ||
/// This module has to be executed every tick to work! | ||
/// | ||
/// | constructor | | | ||
/// |--|--| | ||
/// |name|used to identify different click Events| | ||
/// |onClick| Widget that is executed if the COAS is clicked | | ||
/// |selectedItem| just triggers the click if this Item is selected(optional) | | ||
/// |path| path to create the click handler function(default = `events/`) | | ||
ClickEvent( | ||
{this.name = "objd_click", | ||
this.onClick, | ||
this.selectedItem, | ||
this.path = "events/"}); | ||
|
||
@override | ||
generate(Context context) { | ||
return For.of([ | ||
Scoreboard("objd_click", | ||
type: "minecraft.used:minecraft.carrot_on_a_stick"), | ||
Execute.asat( | ||
Entity.All( | ||
scores: [ | ||
_score.matchesRange( | ||
Range(from: 1), | ||
), | ||
], | ||
nbt: selectedItem != null | ||
? {"SelectedItem": selectedItem.getMap()} | ||
: null), | ||
children: [File.execute(path + name, create: false)]), | ||
]); | ||
} | ||
|
||
List<File> registerFiles() => <File>[ | ||
File( | ||
path + name, | ||
child: For.of([ | ||
onClick, | ||
_score.reset(), | ||
]), | ||
), | ||
]; | ||
} |
Oops, something went wrong.