Skip to content

Commit

Permalink
v0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevertus committed Jun 10, 2021
1 parent 479f66a commit fb5cc39
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 20 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
## 0.4.2

**BREAKING**

- changed the default for If.assignTag to Entity.Self as this is more common than Entity.Player

**Fixes**

- added new Marker Widget to easily create new Markers(you can use it where ever Summon can be used)
- added `Entity.Marker` selector that selects all markers with an optional data field
- added `breakItem` to CustomBlock to manually specify the item that should be killed if player breaks the block
- updated all blocks, items and particles to include changes in 1.17
- updated ReplaceItem to reflect all the changes to the /item command
- changed the list in For to be non nullable
- changed CustomBlock break distance to 0.5(instead of 1)
- changed the default for If.assignTag to Entity.Self as this is more common than Entity.Player
- changed behaviour of Condition.not when used with a tag, this will generate [tag=!name] now instead of unless
- fixed `List<Widget?>` is not a subtype of type `Widget`

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Open the pubspec.yaml file and add
```yaml
name: [unique_namespace]
dependencies:
objd: ^0.4.1
objd: ^0.4.2
```
Also remember to replace the `[unique_namespace]` with your own project name.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/basic/widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import 'package:objd/src/build/build.dart';
/// A widget is the base element for basically everything in objD.
abstract class Widget {
dynamic generate(Context context);
dynamic? toMap() => null;
dynamic toMap() => null;
}
1 change: 0 additions & 1 deletion lib/src/utils/marker.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:objd/src/basic/types/entity.dart';
import 'package:objd/src/basic/types/location.dart';
import 'package:objd/src/basic/text_components.dart';
import 'package:objd/src/basic/widgets.dart';
import 'package:objd/src/wrappers/summon.dart';

Expand Down
14 changes: 7 additions & 7 deletions lib/src/utils/storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Storage extends Widget {
this.autoNamespace = true,
required String key,
required dynamic value,
}) : nbt = {key: value},
}) : nbt = {key: value},
key = key,
_type = _StorageType.merge;

Expand All @@ -43,7 +43,7 @@ class Storage extends Widget {
this.name, {
this.autoNamespace = true,
required this.nbt,
}) : assert(nbt != null),
}) : assert(nbt != null),
_type = _StorageType.merge;

/// To get a value back, use Storage.get.
Expand All @@ -52,15 +52,15 @@ class Storage extends Widget {
this.autoNamespace = true,
this.scale = 1,
required this.key,
}) : assert(key != null),
}) : assert(key != null),
_type = _StorageType.get;

/// Removes certain Nbt Data.
Storage.remove(
this.name, {
this.autoNamespace = true,
required this.key,
}) : assert(key != null),
}) : assert(key != null),
_type = _StorageType.remove;

/// Modifies Nbt Data(look at [Data Widget](/basics#data)).
Expand All @@ -69,7 +69,7 @@ class Storage extends Widget {
required String toPath,
this.autoNamespace = true,
required DataModify modify,
}) : _modify = modify,
}) : _modify = modify,
key = toPath,
_type = _StorageType.modify;

Expand All @@ -79,7 +79,7 @@ class Storage extends Widget {
this.autoNamespace = true,
required this.key,
required Data data,
}) : assert(key != null),
}) : assert(key != null),
assert(data.subcommand == 'get',
'You have to insert a Data.get into copyData!'),
data = data,
Expand All @@ -93,7 +93,7 @@ class Storage extends Widget {
this.datatype = 'byte',
required this.key,
required this.score,
}) : assert(score != null),
}) : assert(score != null),
assert(key != null),
_type = _StorageType.score;

Expand Down
1 change: 1 addition & 0 deletions lib/src/utils/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ export 'version_check.dart';
export 'pass_trait.dart';
export 'player_join.dart';
export 'recipe.dart';
export 'marker.dart';
4 changes: 2 additions & 2 deletions lib/src/wrappers/attribute.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ class Attribute extends RestActionAble {
this.target,
this.attribute, {
required this.value,
}) : _type = _AttributeType.set,
}) : _type = _AttributeType.set,
assert(value != null);

/// removes a modifier with an uuid again
Attribute.remove(
this.target,
this.attribute, {
required this.uuid,
}) : _type = _AttributeType.remove,
}) : _type = _AttributeType.remove,
assert(uuid != null);

///gets the calculated modifier(with base, armor and custom)
Expand Down
4 changes: 2 additions & 2 deletions lib/src/wrappers/execute.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Execute extends RestActionAble {
this.children = const [],
Entity? as,
Entity? at,
dynamic? location,
dynamic location,
String? align,
this.targetFilePath = 'objd',
this.targetFileName,
Expand Down Expand Up @@ -68,7 +68,7 @@ class Execute extends RestActionAble {
required Function(List<Widget>) run,
Entity? as,
Entity? at,
dynamic? location,
dynamic location,
String? align,
String targetFilePath = 'objd',
String? targetFileName,
Expand Down
12 changes: 7 additions & 5 deletions lib/src/wrappers/if.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,13 @@ class If extends RestActionAble {
),
);
});
final prefix = 'execute' +
(assignTag == null || assignTag!.selector == 's'
? ''
: ' as $assignTag');

children.add(Group(
prefix:
'execute as ' + assignTag.toString() + ' if entity @s[tag=$tag] run',
prefix: '$prefix if entity @s[tag=$tag] run',
path: targetFilePath,
generateIDs: targetFileName == null,
filename: targetFileName ?? 'if',
Expand All @@ -145,9 +149,7 @@ class If extends RestActionAble {
if (orElse != null) {
children.add(
Group(
prefix: 'execute as ' +
assignTag.toString() +
' unless entity @s[tag=$tag] run',
prefix: '$prefix unless entity @s[tag=$tag] run',
path: targetFilePath,
filename: 'else',
groupMin: encapsulate ? 3 : -1,
Expand Down

0 comments on commit fb5cc39

Please sign in to comment.