ActionLib

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 0.11.0
本资源为搬运资源,原资源地址: https://modrinth.com/mod/actionlib1
资源信息

Minecraft 版本: 1.13 1.13.1 1.13.2 1.14 1.14.1 1.14.2 1.14.3 1.14.4 1.15 1.15.1 1.15.2 1.16 1.16.1 1.16.2 1.16.3 1.16.4 1.16.5 1.17 1.17.1 1.18 1.18.1 1.18.2 1.19 1.19.1 1.19.2 1.19.3 1.19.4 1.20 1.20.1 1.20.2 1.20.3 1.20.4 1.20.5 1.20.6 1.21 1.21.1 1.21.2 1.21.3 1.21.4 1.21.5 1.21.6 1.21.7 1.21.8 1.21.9 1.21.10 1.21.11

平台: paper spigot

标签: game-mechanics library mobs

资源介绍

ActionLib is used to easily implement JSON based data-driven actions, e.g. setting a players health or saturation, or showing a random inventory.

Better documentation can be found here

Default Actions:
trip: Drops the player's entire inventory onto the ground
teleport_player: Allows teleporting the player
spawn_entity: Spawns the specified entity randomly within a radius
smite: Strikes the player with lightning
show_screen: Shows the player a specified screen (Currently only supports the demo screen)
set_saturation: Sets the player's saturation level
set_player_armor: Sets the player's armor
set_level: Sets the player's xp level
set_health: Sets the player's health
set_gamemode: Sets the player's gamemode
set_food_level: Sets the player's food level
set_fire: Sets the player on fire
send_title: Sends a title to the player
send_message: Sends a message to the player
potion_effect: Allows adding, removing, and clearing the player's potion effects
player_chat: Has the player send the specified message
play_sound: Plays a specific sound to the player
open_inventory: Causes the player to open a random or specified inventory (Different than show_screen)
launch_entity: Allows launching all entities (or just the player) into the air
kick_player: Kicks the player
give_item: Gives the player a specified item
flip_player: Flips the player 180 degrees
drop_item: Drops the item in either the player's main hand or the player's off hand

Adding custom actions:
Custom actions are added by extending the "AbstractAction" class and using the "ActionType" annotation

@ActionType(value = "name_of_action")
public class CustomAction extends AbstractAction {

public CustomAction(JavaPlugin plugin) {
super(plugin);
}

// Optional loadFromJson to load from the action's json object

@Override
public void execute(Player target, String[] args) {
// Execution code is here
}

}


Registering custom actions:
ActionRegistry.registerActionsFromPackage("com.example.package", javaPluginInstance);


Using actions:
ActionObjectManager manager = new ActionObjectManager();

JsonObject jsonObject = JsonParser.parseReader(new FileReader(file)).getAsJsonObject();

ActionObject newAction = new ActionObject(plugin, jsonObject);
manager.addActionObject(newAction);

ActionObject action = manager.getEnabledActionObjectByName(args[1]);

action.execute(target, Arrays.copyOfRange(args, 2, args.length));

下载太慢?试试 墨喵加速站,支持 Modrinth 和外网直链高速下载! 用的人越多,下载的越快!
下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
Minecraft Multiverse

价格:0 墨喵币
下载量:0

查看详情
Accurately 3D Mace

价格:0 墨喵币
下载量:0

查看详情
Flashback Server

价格:0 墨喵币
下载量:0

查看详情
Frostwalker always melts

价格:0 墨喵币
下载量:0

查看详情