Package dev.latvian.mods.kubejs.event
Class EventHandler
java.lang.Object
dev.latvian.mods.rhino.ScriptableObject
dev.latvian.mods.rhino.IdScriptableObject
dev.latvian.mods.rhino.BaseFunction
dev.latvian.mods.kubejs.event.EventHandler
- All Implemented Interfaces:
dev.latvian.mods.rhino.Callable,dev.latvian.mods.rhino.ConstProperties,dev.latvian.mods.rhino.Function,dev.latvian.mods.rhino.IdEnumerationIterator,dev.latvian.mods.rhino.IdFunctionCall,dev.latvian.mods.rhino.Scriptable,dev.latvian.mods.rhino.SymbolScriptable
- Direct Known Subclasses:
TargetedEventHandler
public class EventHandler
extends dev.latvian.mods.rhino.BaseFunction
Example
public static final EventHandler CLIENT_RIGHT_CLICKED = ItemEvents.GROUP.client("clientRightClicked", () -> ItemClickedEventJS.class).extra(ItemEvents.SUPPORTS_ITEM);
-
Nested Class Summary
Nested classes/interfaces inherited from class dev.latvian.mods.rhino.ScriptableObject
dev.latvian.mods.rhino.ScriptableObject.KeyComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EventHandlerContainer[]final EventGroupfinal Stringprotected dev.latvian.mods.rhino.type.TypeInfofinal ScriptTypePredicatebooleanFields inherited from class dev.latvian.mods.rhino.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface dev.latvian.mods.rhino.Scriptable
NOT_FOUND -
Method Summary
Modifier and TypeMethodDescriptioncall(dev.latvian.mods.rhino.Context cx, dev.latvian.mods.rhino.Scriptable scope, dev.latvian.mods.rhino.Scriptable thisObj, Object[] args) voidclear(ScriptType type) protected EventHandlerContainer[]exceptionHandler(EventExceptionHandler handler) voidforEachListener(ScriptType type, Consumer<EventHandlerContainer> callback) @Nullable dev.latvian.mods.rhino.type.TypeInfobooleanhasResult(dev.latvian.mods.rhino.type.TypeInfo result) Allow event.cancel() to be calledvoidlisten(@Nullable dev.latvian.mods.rhino.Context cx, ScriptType type, @Nullable Object extraId, IEventHandler handler) voidlistenJava(ScriptType type, @Nullable Object extraId, IEventHandler handler) post(ScriptTypeHolder scriptType, KubeEvent event) protected EventResultpostInternal(ScriptTypeHolder type, @Nullable Object extraId, KubeEvent event) <E> TargetedEventHandler<E> requiredTarget(EventTargetType<E> type) Marks this event handler to require a target, usually needed for events related to registries<E> TargetedEventHandler<E> supportsTarget(EventTargetType<E> type) Marks this event handler to support a target, usually needed for events related to registriestoString()Methods inherited from class dev.latvian.mods.rhino.BaseFunction
construct, createObject, execIdCall, fillConstructorProperties, findInstanceIdInfo, findPrototypeId, getArity, getClassName, getClassPrototype, getFunctionName, getInstanceIdName, getInstanceIdValue, getLength, getMaxInstanceId, getPrototypeProperty, getTypeOf, hasInstance, hasPrototypeProperty, initPrototypeId, isGeneratorFunction, setImmunePrototypeProperty, setInstanceIdAttributes, setInstanceIdValue, toFunctionStringMethods inherited from class dev.latvian.mods.rhino.IdScriptableObject
activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, delete, exportAsJSClass, findInstanceIdInfo, findPrototypeId, get, get, getAttributes, getAttributes, getOwnPropertyDescriptor, has, has, hasPrototypeMap, incompatibleCallError, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, put, put, setAttributesMethods inherited from class dev.latvian.mods.rhino.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, checkPropertyChange, checkPropertyDefinition, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, sizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.latvian.mods.rhino.Scriptable
delete, delete, enumerationIteratorHasNext, enumerationIteratorNext, get, get, getAllIds, getDefaultValue, getIds, getParentScope, getPrototype, has, has, put, put, setParentScope, setPrototype
-
Field Details
-
group
-
name
-
scriptTypePredicate
-
eventType
-
result
protected dev.latvian.mods.rhino.type.TypeInfo result -
target
-
targetRequired
public transient boolean targetRequired -
eventContainers
-
exceptionHandler
-
-
Method Details
-
hasResult
Allow event.cancel() to be called -
hasResult
-
getResult
@HideFromJS @Nullable public @Nullable dev.latvian.mods.rhino.type.TypeInfo getResult() -
exceptionHandler
-
requiredTarget
Marks this event handler to require a target, usually needed for events related to registries -
supportsTarget
Marks this event handler to support a target, usually needed for events related to registries -
clear
-
hasListeners
public boolean hasListeners() -
listen
public void listen(@Nullable @Nullable dev.latvian.mods.rhino.Context cx, ScriptType type, @Nullable @Nullable Object extraId, IEventHandler handler) -
createMap
-
listenJava
@HideFromJS public void listenJava(ScriptType type, @Nullable @Nullable Object extraId, IEventHandler handler) -
post
- See Also:
-
post
- Returns:
- EventResult that can contain an object. What previously returned true on
KubeEvent.cancel(Context)()} now returnsEventResult.interruptFalse() - See Also:
-
postInternal
protected EventResult postInternal(ScriptTypeHolder type, @Nullable @Nullable Object extraId, KubeEvent event) -
toString
- Overrides:
toStringin classdev.latvian.mods.rhino.BaseFunction
-
call
public Object call(dev.latvian.mods.rhino.Context cx, dev.latvian.mods.rhino.Scriptable scope, dev.latvian.mods.rhino.Scriptable thisObj, Object[] args) - Specified by:
callin interfacedev.latvian.mods.rhino.Callable- Specified by:
callin interfacedev.latvian.mods.rhino.Function- Overrides:
callin classdev.latvian.mods.rhino.BaseFunction
-
forEachListener
-