Skip to content

Commit

Permalink
property impls for tag return type registration
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 20, 2021
1 parent 9535900 commit f894e8e
Show file tree
Hide file tree
Showing 54 changed files with 117 additions and 116 deletions.
Expand Up @@ -53,7 +53,7 @@ public static void registerTags() {
// @description
// If the entity is an armor stand, returns whether the armor stand can tick.
// -->
PropertyParser.<EntityCanTick>registerTag("can_tick", (attribute, entity) -> {
PropertyParser.<EntityCanTick, ElementTag>registerTag(ElementTag.class, "can_tick", (attribute, entity) -> {
return new ElementTag(((ArmorStand) entity.entity.getBukkitEntity()).canTick());
});
}
Expand Down
Expand Up @@ -55,7 +55,7 @@ public static void registerTags() {
// If the entity is an experience orb, returns its spawn reason.
// Valid spawn reasons can be found at <@link url https://papermc.io/javadocs/paper/org/bukkit/entity/ExperienceOrb.SpawnReason.html>
// -->
PropertyParser.<EntityExperienceOrb>registerTag("xp_spawn_reason", (attribute, entity) -> {
PropertyParser.<EntityExperienceOrb, ElementTag>registerTag(ElementTag.class, "xp_spawn_reason", (attribute, entity) -> {
return new ElementTag(((ExperienceOrb) entity.entity.getBukkitEntity()).getSpawnReason().name());
});

Expand All @@ -68,7 +68,7 @@ public static void registerTags() {
// If the entity is an experience orb, returns the entity that triggered it spawning (if any).
// For example, if a player killed an entity this would return the player.
// -->
PropertyParser.<EntityExperienceOrb>registerTag("xp_trigger", (attribute, entity) -> {
PropertyParser.<EntityExperienceOrb, EntityTag>registerTag(EntityTag.class, "xp_trigger", (attribute, entity) -> {
UUID uuid = ((ExperienceOrb) entity.entity.getBukkitEntity()).getTriggerEntityId();
if (uuid == null) {
return null;
Expand All @@ -89,7 +89,7 @@ public static void registerTags() {
// If the entity is an experience orb, returns the entity that it was created from (if any).
// For example, if the xp orb was spawned from breeding this would return the baby.
// -->
PropertyParser.<EntityExperienceOrb>registerTag("xp_source", (attribute, entity) -> {
PropertyParser.<EntityExperienceOrb, EntityTag>registerTag(EntityTag.class, "xp_source", (attribute, entity) -> {
UUID uuid = ((ExperienceOrb) entity.entity.getBukkitEntity()).getSourceEntityId();
if (uuid == null) {
return null;
Expand Down
Expand Up @@ -49,7 +49,7 @@ public static void registerTags() {
// @description
// Returns whether the entity was spawned from a spawner.
// -->
PropertyParser.<EntityFromSpawner>registerTag("from_spawner", (attribute, entity) -> {
PropertyParser.<EntityFromSpawner, ElementTag>registerTag(ElementTag.class, "from_spawner", (attribute, entity) -> {
return new ElementTag(entity.entity.getBukkitEntity().fromMobSpawner());
});
}
Expand Down
Expand Up @@ -50,7 +50,7 @@ public static void registerTags() {
// @description
// Returns the initial spawn location of this entity.
// -->
PropertyParser.<EntitySpawnLocation>registerTag("spawn_location", (attribute, entity) -> {
PropertyParser.<EntitySpawnLocation, LocationTag>registerTag(LocationTag.class, "spawn_location", (attribute, entity) -> {
Location loc = entity.entity.getBukkitEntity().getOrigin();
return loc != null ? new LocationTag(loc) : null;
});
Expand Down
Expand Up @@ -48,7 +48,7 @@ public static void registerTags() {
// @description
// Returns the rarity of an item, as "common", "uncommon", "rare", or "epic".
// -->
PropertyParser.<PaperItemTagProperties>registerTag("rarity", (attribute, item) -> {
PropertyParser.<PaperItemTagProperties, ElementTag>registerTag(ElementTag.class, "rarity", (attribute, item) -> {
return new ElementTag(item.item.getItemStack().getRarity().name());
});
}
Expand Down
Expand Up @@ -51,7 +51,7 @@ public static void registerTags() {
// @description
// Returns whether the player affects monster spawning. When false, no monsters will spawn naturally because of this player.
// -->
PropertyParser.<PlayerAffectsMonsterSpawning>registerTag("affects_monster_spawning", (attribute, player) -> {
PropertyParser.<PlayerAffectsMonsterSpawning, ElementTag>registerTag(ElementTag.class, "affects_monster_spawning", (attribute, player) -> {
return new ElementTag(player.player.getPlayerEntity().getAffectsSpawning());
});
}
Expand Down
Expand Up @@ -52,7 +52,7 @@ public static void registerTags() {
// @description
// Returns the view distance of this world. Chunks are tracked inside this radius.
// -->
PropertyParser.<WorldViewDistance>registerTag("view_distance", (attribute, world) -> {
PropertyParser.<WorldViewDistance, ElementTag>registerTag(ElementTag.class, "view_distance", (attribute, world) -> {
return new ElementTag(world.world.getWorld().getViewDistance());
});

Expand All @@ -66,7 +66,7 @@ public static void registerTags() {
// Returns the non-ticking view distance of this world. Chunks will not be tracked between the world's view distance and its non-ticking view distance.
// This allows your world to have a higher visual view distance without impacting performance.
// -->
PropertyParser.<WorldViewDistance>registerTag("no_tick_view_distance", (attribute, world) -> {
PropertyParser.<WorldViewDistance, ElementTag>registerTag(ElementTag.class, "no_tick_view_distance", (attribute, world) -> {
return new ElementTag(world.world.getWorld().getNoTickViewDistance());
});
}
Expand Down

0 comments on commit f894e8e

Please sign in to comment.