From 3b233151152b022d1b71fa5fe6c7ec2f902b0adc Mon Sep 17 00:00:00 2001 From: liach <7806504+liach@users.noreply.github.com> Date: Sat, 13 Feb 2021 11:01:00 -0600 Subject: [PATCH] Game events stuff. Map 2 unmapped top level classes (#2045) * Game events stuff. Map 2 unmapped top level classes Signed-off-by: liach * Update mappings/net/minecraft/world/event/listener/EntityGameEventHandler.mapping Co-authored-by: YanisBft * Update mappings/net/minecraft/world/event/PositionSource.mapping Co-authored-by: liach Co-authored-by: YanisBft --- mappings/net/minecraft/class_5711.mapping | 5 ---- mappings/net/minecraft/class_5713.mapping | 11 -------- .../debug/GameEventDebugRenderer.mapping | 16 +++++++++-- mappings/net/minecraft/entity/Entity.mapping | 19 +++++++++++++ .../server/network/DebugInfoSender.mapping | 4 +-- .../net/minecraft/world/chunk/Chunk.mapping | 4 +++ .../minecraft/world/chunk/WorldChunk.mapping | 3 +++ .../world/event/PositionSource.mapping | 8 +++++- .../listener/EntityGameEventHandler.mapping | 27 +++++++++++++++++++ .../listener/GameEventDispatcher.mapping | 22 +++++++++++++++ .../event/listener/GameEventListener.mapping | 6 +++++ .../listener/SculkSensorListener.mapping | 15 ++++++----- .../SimpleGameEventDispatcher.mapping | 17 ++++++++++++ 13 files changed, 130 insertions(+), 27 deletions(-) delete mode 100644 mappings/net/minecraft/class_5711.mapping delete mode 100644 mappings/net/minecraft/class_5713.mapping create mode 100644 mappings/net/minecraft/world/event/listener/EntityGameEventHandler.mapping create mode 100644 mappings/net/minecraft/world/event/listener/GameEventDispatcher.mapping create mode 100644 mappings/net/minecraft/world/event/listener/SimpleGameEventDispatcher.mapping diff --git a/mappings/net/minecraft/class_5711.mapping b/mappings/net/minecraft/class_5711.mapping deleted file mode 100644 index b613ba7dc0..0000000000 --- a/mappings/net/minecraft/class_5711.mapping +++ /dev/null @@ -1,5 +0,0 @@ -CLASS net/minecraft/class_5711 - FIELD field_28142 listeners Ljava/util/List; - FIELD field_28143 world Lnet/minecraft/class_1937; - METHOD (Lnet/minecraft/class_1937;)V - ARG 1 world diff --git a/mappings/net/minecraft/class_5713.mapping b/mappings/net/minecraft/class_5713.mapping deleted file mode 100644 index e32a1a4e81..0000000000 --- a/mappings/net/minecraft/class_5713.mapping +++ /dev/null @@ -1,11 +0,0 @@ -CLASS net/minecraft/class_5713 - FIELD field_28181 EMPTY Lnet/minecraft/class_5713; - METHOD method_32942 isEmpty ()Z - METHOD method_32943 listen (Lnet/minecraft/class_5712;Lnet/minecraft/class_1297;Lnet/minecraft/class_2338;)V - ARG 1 event - ARG 2 entity - ARG 3 pos - METHOD method_32944 addListener (Lnet/minecraft/class_5714;)V - ARG 1 listener - METHOD method_32945 removeListener (Lnet/minecraft/class_5714;)V - ARG 1 listener diff --git a/mappings/net/minecraft/client/render/debug/GameEventDebugRenderer.mapping b/mappings/net/minecraft/client/render/debug/GameEventDebugRenderer.mapping index 725f47bc33..0d507f19f9 100644 --- a/mappings/net/minecraft/client/render/debug/GameEventDebugRenderer.mapping +++ b/mappings/net/minecraft/client/render/debug/GameEventDebugRenderer.mapping @@ -1,9 +1,18 @@ CLASS net/minecraft/class_5739 net/minecraft/client/render/debug/GameEventDebugRenderer FIELD field_28255 client Lnet/minecraft/class_310; + FIELD field_28256 entries Ljava/util/List; + FIELD field_28257 listeners Ljava/util/List; METHOD (Lnet/minecraft/class_310;)V ARG 1 client - CLASS class_5740 Listener - CLASS class_5741 + METHOD method_33086 (Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_5739$class_5741;)Z + ARG 2 listener + METHOD method_33091 (Lnet/minecraft/class_5739$class_5741;Lnet/minecraft/class_4587;Lnet/minecraft/class_4588;DDDLnet/minecraft/class_2338;)V + ARG 9 pos + CLASS class_5740 Entry + FIELD field_28258 startingMs J + FIELD field_28259 event Lnet/minecraft/class_5712; + METHOD method_33093 hasExpired ()Z + CLASS class_5741 Listener FIELD field_28261 positionSource Lnet/minecraft/class_5716; FIELD field_28262 range I METHOD (Lnet/minecraft/class_5716;I)V @@ -11,3 +20,6 @@ CLASS net/minecraft/class_5739 net/minecraft/client/render/debug/GameEventDebugR ARG 2 range METHOD method_33094 getPos (Lnet/minecraft/class_1937;)Ljava/util/Optional; ARG 1 world + METHOD method_33095 isTooFar (Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;)Z + ARG 1 world + ARG 2 pos diff --git a/mappings/net/minecraft/entity/Entity.mapping b/mappings/net/minecraft/entity/Entity.mapping index ebc89c2c1f..fed936a2ee 100644 --- a/mappings/net/minecraft/entity/Entity.mapping +++ b/mappings/net/minecraft/entity/Entity.mapping @@ -306,8 +306,27 @@ CLASS net/minecraft/class_1297 net/minecraft/entity/Entity METHOD method_32319 setInPowderSnow (Z)V ARG 1 inPowderSnow METHOD method_32875 emitGameEvent (Lnet/minecraft/class_5712;Lnet/minecraft/class_1297;)V + ARG 1 event + ARG 2 entity METHOD method_32876 emitGameEvent (Lnet/minecraft/class_5712;)V + ARG 1 event + METHOD method_32877 getGameEventHandler ()Lnet/minecraft/class_5715; + COMMENT Returns the game event handler for this entity. + COMMENT + COMMENT

Subclasses interested in listening to game events as an entity should return a + COMMENT handler so the {@link net.minecraft.world.event.listener.GameEventListener listener} + COMMENT used to receive game events can be registered to the correct dispatchers. + COMMENT + COMMENT @implNote The vanilla implementation always returns {@code null}. METHOD method_33189 occludeVibrationSignals ()Z + METHOD method_33568 emitGameEvent (Lnet/minecraft/class_5712;Lnet/minecraft/class_1297;Lnet/minecraft/class_2338;)V + ARG 1 event + ARG 2 entity + ARG 3 pos + METHOD method_33569 emitGameEvent (Lnet/minecraft/class_5712;Lnet/minecraft/class_2338;)V + ARG 1 event + ARG 2 pos + METHOD method_33571 getEyePos ()Lnet/minecraft/class_243; METHOD method_33572 setOnFire (Z)V ARG 1 onFire METHOD method_5621 getMountedHeightOffset ()D diff --git a/mappings/net/minecraft/server/network/DebugInfoSender.mapping b/mappings/net/minecraft/server/network/DebugInfoSender.mapping index 721b7df13d..0fa48471bf 100644 --- a/mappings/net/minecraft/server/network/DebugInfoSender.mapping +++ b/mappings/net/minecraft/server/network/DebugInfoSender.mapping @@ -53,10 +53,10 @@ CLASS net/minecraft/class_4209 net/minecraft/server/network/DebugInfoSender METHOD method_24819 (Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;)V ARG 0 world ARG 1 pos - METHOD method_33139 (Lnet/minecraft/class_1937;Lnet/minecraft/class_5712;Lnet/minecraft/class_2338;)V + METHOD method_33139 sendGameEvent (Lnet/minecraft/class_1937;Lnet/minecraft/class_5712;Lnet/minecraft/class_2338;)V ARG 0 world ARG 1 event ARG 2 pos - METHOD method_33140 (Lnet/minecraft/class_1937;Lnet/minecraft/class_5714;)V + METHOD method_33140 sendGameEventListener (Lnet/minecraft/class_1937;Lnet/minecraft/class_5714;)V ARG 0 world ARG 1 eventListener diff --git a/mappings/net/minecraft/world/chunk/Chunk.mapping b/mappings/net/minecraft/world/chunk/Chunk.mapping index 1b8e0ef019..ae12579a39 100644 --- a/mappings/net/minecraft/world/chunk/Chunk.mapping +++ b/mappings/net/minecraft/world/chunk/Chunk.mapping @@ -61,3 +61,7 @@ CLASS net/minecraft/class_2791 net/minecraft/world/chunk/Chunk ARG 2 upperHeight METHOD method_20598 getPackedBlockEntityTag (Lnet/minecraft/class_2338;)Lnet/minecraft/class_2487; ARG 1 pos + METHOD method_32914 getGameEventDispatcher (I)Lnet/minecraft/class_5713; + ARG 1 ySectionCoord + METHOD method_33729 getSection (I)Lnet/minecraft/class_2826; + ARG 1 yIndex diff --git a/mappings/net/minecraft/world/chunk/WorldChunk.mapping b/mappings/net/minecraft/world/chunk/WorldChunk.mapping index e34482a229..3182073107 100644 --- a/mappings/net/minecraft/world/chunk/WorldChunk.mapping +++ b/mappings/net/minecraft/world/chunk/WorldChunk.mapping @@ -22,6 +22,7 @@ CLASS net/minecraft/class_2818 net/minecraft/world/chunk/WorldChunk FIELD field_20655 biomeArray Lnet/minecraft/class_4548; FIELD field_27221 EMPTY_BLOCK_ENTITY_TICKER Lnet/minecraft/class_5562; FIELD field_27222 blockEntityTickers Ljava/util/Map; + FIELD field_28129 gameEventDispatchers Lit/unimi/dsi/fastutil/ints/Int2ObjectMap; METHOD (Lnet/minecraft/class_1937;Lnet/minecraft/class_1923;Lnet/minecraft/class_4548;)V ARG 1 world ARG 2 pos @@ -90,6 +91,8 @@ CLASS net/minecraft/class_2818 net/minecraft/world/chunk/WorldChunk METHOD method_31724 canTickBlockEntity (Lnet/minecraft/class_2338;)Z ARG 1 pos METHOD method_31725 removeBlockEntityTicker (Lnet/minecraft/class_2338;)V + METHOD method_32917 (I)Lnet/minecraft/class_5713; + ARG 1 sectionCoord CLASS 1 EmptyBlockEntityTickInvoker CLASS class_2819 CreationType CLASS class_5563 DirectBlockEntityTickInvoker diff --git a/mappings/net/minecraft/world/event/PositionSource.mapping b/mappings/net/minecraft/world/event/PositionSource.mapping index bbf0b7e54a..471d2c824e 100644 --- a/mappings/net/minecraft/world/event/PositionSource.mapping +++ b/mappings/net/minecraft/world/event/PositionSource.mapping @@ -1,5 +1,11 @@ CLASS net/minecraft/class_5716 net/minecraft/world/event/PositionSource - FIELD field_28184 TYPE_CODEC Lcom/mojang/serialization/Codec; + COMMENT A position source is a property of a game event listener. + COMMENT + COMMENT @see net.minecraft.world.event.listener.GameEventListener#getPositionSource() + FIELD field_28184 CODEC Lcom/mojang/serialization/Codec; + COMMENT A codec for encoding and decoding any position source whose {@link #getType() type} + COMMENT is in the {@link net.minecraft.util.registry.Registry#POSITION_SOURCE_TYPE registry}. METHOD method_32955 getType ()Lnet/minecraft/class_5717; + COMMENT Returns the type of this position source. METHOD method_32956 getPos (Lnet/minecraft/class_1937;)Ljava/util/Optional; ARG 1 world diff --git a/mappings/net/minecraft/world/event/listener/EntityGameEventHandler.mapping b/mappings/net/minecraft/world/event/listener/EntityGameEventHandler.mapping new file mode 100644 index 0000000000..4ac9f799cc --- /dev/null +++ b/mappings/net/minecraft/world/event/listener/EntityGameEventHandler.mapping @@ -0,0 +1,27 @@ +CLASS net/minecraft/class_5715 net/minecraft/world/event/listener/EntityGameEventHandler + COMMENT A game event handler for an entity so that the listener stored can be + COMMENT moved to the correct dispatcher or unregistered as the entity moves or + COMMENT gets removed. + COMMENT + COMMENT @apiNote This implementation is currently unused by vanilla as vanilla + COMMENT doesn't have any entity that listens to game events. + COMMENT + COMMENT @see net.minecraft.entity.Entity#getGameEventHandler() + FIELD field_28182 listener Lnet/minecraft/class_5714; + FIELD field_28183 sectionPos Lnet/minecraft/class_4076; + METHOD (Lnet/minecraft/class_5714;)V + ARG 1 listener + METHOD method_32949 onEntityRemoval (Lnet/minecraft/class_1937;)V + ARG 1 world + METHOD method_32950 updateDispatcher (Lnet/minecraft/class_1937;Lnet/minecraft/class_4076;Ljava/util/function/Consumer;)V + ARG 1 world + ARG 2 sectionPos + ARG 3 action + METHOD method_32951 (Lnet/minecraft/class_5713;)V + ARG 1 dispatcher + METHOD method_32952 onEntitySetPos (Lnet/minecraft/class_1937;)V + ARG 1 world + METHOD method_32953 (Lnet/minecraft/class_5713;)V + ARG 1 dispatcher + METHOD method_32954 (Lnet/minecraft/class_5713;)V + ARG 1 dispatcher diff --git a/mappings/net/minecraft/world/event/listener/GameEventDispatcher.mapping b/mappings/net/minecraft/world/event/listener/GameEventDispatcher.mapping new file mode 100644 index 0000000000..e928d922b7 --- /dev/null +++ b/mappings/net/minecraft/world/event/listener/GameEventDispatcher.mapping @@ -0,0 +1,22 @@ +CLASS net/minecraft/class_5713 net/minecraft/world/event/listener/GameEventDispatcher + COMMENT A game event dispatcher dispatches game events to its listeners. + FIELD field_28181 EMPTY Lnet/minecraft/class_5713; + COMMENT An unmodifiable, empty (non-operative) dispatcher. + METHOD method_32942 isEmpty ()Z + COMMENT Returns whether this dispatcher has no listeners. + METHOD method_32943 dispatch (Lnet/minecraft/class_5712;Lnet/minecraft/class_1297;Lnet/minecraft/class_2338;)V + COMMENT Dispatches an event to all the listeners in this dispatcher. + ARG 1 event + COMMENT the event + ARG 2 entity + COMMENT an entity related to the event + ARG 3 pos + COMMENT the block position of the event + METHOD method_32944 addListener (Lnet/minecraft/class_5714;)V + COMMENT Adds a listener to this dispatcher. + ARG 1 listener + COMMENT the listener to add + METHOD method_32945 removeListener (Lnet/minecraft/class_5714;)V + COMMENT Removes a listener from this dispatcher if it is present. + ARG 1 listener + COMMENT the listener to remove diff --git a/mappings/net/minecraft/world/event/listener/GameEventListener.mapping b/mappings/net/minecraft/world/event/listener/GameEventListener.mapping index 955a90873e..8e4f65f02d 100644 --- a/mappings/net/minecraft/world/event/listener/GameEventListener.mapping +++ b/mappings/net/minecraft/world/event/listener/GameEventListener.mapping @@ -1,8 +1,14 @@ CLASS net/minecraft/class_5714 net/minecraft/world/event/listener/GameEventListener + COMMENT A game event listener listens to game events from {@link GameEventDispatcher}s. METHOD method_32946 getPositionSource ()Lnet/minecraft/class_5716; + COMMENT Returns the position source of this listener. METHOD method_32947 listen (Lnet/minecraft/class_1937;Lnet/minecraft/class_5712;Lnet/minecraft/class_1297;Lnet/minecraft/class_2338;)Z + COMMENT Listens to an incoming game event. + COMMENT + COMMENT @return {@code true} if the game event has been accepted by this listener ARG 1 world ARG 2 event ARG 3 entity ARG 4 pos METHOD method_32948 getRange ()I + COMMENT Returns the range, in blocks, of the listener. diff --git a/mappings/net/minecraft/world/event/listener/SculkSensorListener.mapping b/mappings/net/minecraft/world/event/listener/SculkSensorListener.mapping index c1b8c2dc0f..d8968bd2fd 100644 --- a/mappings/net/minecraft/world/event/listener/SculkSensorListener.mapping +++ b/mappings/net/minecraft/world/event/listener/SculkSensorListener.mapping @@ -1,15 +1,15 @@ CLASS net/minecraft/class_5718 net/minecraft/world/event/listener/SculkSensorListener FIELD field_28187 positionSource Lnet/minecraft/class_5716; FIELD field_28188 range I - FIELD field_28189 listener Lnet/minecraft/class_5718$class_5719; + FIELD field_28189 callback Lnet/minecraft/class_5718$class_5719; FIELD field_28190 event Ljava/util/Optional; FIELD field_28191 distance I - FIELD field_28192 cooldown I + FIELD field_28192 delay I METHOD (Lnet/minecraft/class_5716;ILnet/minecraft/class_5718$class_5719;)V ARG 1 positionSource ARG 2 range ARG 3 listener - METHOD method_32964 listen (Lnet/minecraft/class_1937;)V + METHOD method_32964 tick (Lnet/minecraft/class_1937;)V ARG 1 world METHOD method_32965 listen (Lnet/minecraft/class_1937;Lnet/minecraft/class_5712;Lnet/minecraft/class_2338;Lnet/minecraft/class_2338;)V ARG 1 world @@ -25,12 +25,15 @@ CLASS net/minecraft/class_5718 net/minecraft/world/event/listener/SculkSensorLis METHOD method_32968 shouldActivate (Lnet/minecraft/class_5712;Lnet/minecraft/class_1297;)Z ARG 1 event ARG 2 entity - CLASS class_5719 Listener - METHOD method_32969 listen (Lnet/minecraft/class_1937;Lnet/minecraft/class_5714;Lnet/minecraft/class_5712;I)V + CLASS class_5719 Callback + METHOD method_32969 accept (Lnet/minecraft/class_1937;Lnet/minecraft/class_5714;Lnet/minecraft/class_5712;I)V + COMMENT Accepts a game event after delay. ARG 1 world ARG 2 listener ARG 3 event - METHOD method_32970 shouldListen (Lnet/minecraft/class_1937;Lnet/minecraft/class_5714;Lnet/minecraft/class_2338;Lnet/minecraft/class_5712;Lnet/minecraft/class_1297;)Z + ARG 4 distance + METHOD method_32970 accepts (Lnet/minecraft/class_1937;Lnet/minecraft/class_5714;Lnet/minecraft/class_2338;Lnet/minecraft/class_5712;Lnet/minecraft/class_1297;)Z + COMMENT Returns whether the callback wants to accept this event. ARG 1 world ARG 2 listener ARG 3 pos diff --git a/mappings/net/minecraft/world/event/listener/SimpleGameEventDispatcher.mapping b/mappings/net/minecraft/world/event/listener/SimpleGameEventDispatcher.mapping new file mode 100644 index 0000000000..516011c7d2 --- /dev/null +++ b/mappings/net/minecraft/world/event/listener/SimpleGameEventDispatcher.mapping @@ -0,0 +1,17 @@ +CLASS net/minecraft/class_5711 net/minecraft/world/event/listener/SimpleGameEventDispatcher + COMMENT A simple game event dispatcher implementation that has hooks to + COMMENT debug info senders. + COMMENT + COMMENT @apiNote Vanilla Minecraft creates it on a per-chunk-section basis. + FIELD field_28142 listeners Ljava/util/List; + FIELD field_28143 world Lnet/minecraft/class_1937; + METHOD (Lnet/minecraft/class_1937;)V + ARG 1 world + METHOD method_32936 dispatchTo (Lnet/minecraft/class_1937;Lnet/minecraft/class_5712;Lnet/minecraft/class_1297;Lnet/minecraft/class_2338;Lnet/minecraft/class_5714;)Z + ARG 1 world + ARG 2 event + ARG 3 entity + ARG 4 pos + ARG 5 listener + METHOD method_32942 isEmpty ()Z + COMMENT Returns whether this dispatcher has no listeners.