Registering custom reactions
To register an emoji, create a Reaction instance and register it in the reaction registry using a NamespacedRegistryKey.
Registering a custom reaction
String namespace = "social"; // Recommended: use your plugin's name
String name = "example"; // Unique identifier for the reaction
String textureUrl = "http://textures.minecraft.net/texture/4ecb3afe9d982d1e1f762c3b13edd8d167dfb964d990163614cb8280ee343a";
Sound sound = Sound.sound(Key.key("entity.wolf.ambient"), Sound.Source.PLAYER, 0.75f, 1.5f); // Optional sound
String particle = "minecraft:block.note_block.bell"; // Optional particle effect
String triggerWord = "woof" // Optional trigger word
Reaction reaction = Reaction.builder(name, textureUrl)
.sound(sound)
.particle(particle)
.triggerWords(triggerWord)
.build();
NamespacedRegistryKey key = RegistryKey.namespaced(namespace, name);
Social.registries().reactions().register(key, reaction);
Hidden reactions
To prevent your reaction from being discoverable by command auto-completion and GUIs, use the hidden namespace:
Getting a reaction by its namespaced key
String namespace = "social";
String name = "example";
NamespacedRegistryKey key = RegistryKey.namespaced(namespace, name);
Optional<Reaction> optionalEmoji = Social.registries().reactions().value(key);
Getting all reactions within a namespace
String namespace = "social";
List<Reaction> emojiList = Social.registries().reactions().valuesByNamespaceComponent(namespace);