TypeConsumer is actually a visitor (#1566)

* TypeConsumer is actually a visitor

And map that one bootstrap method that uses the visitor

* Use a more passive form, use accept and use "visit" name in the right spots.

And fix it to be standard with naming.

* Indentation

* Update mappings/net/minecraft/world/GameRules.mapping

Co-authored-by: shartte <shartte@users.noreply.github.com>

* Update mappings/net/minecraft/world/GameRules.mapping

Co-authored-by: shartte <shartte@users.noreply.github.com>

Co-authored-by: shartte <shartte@users.noreply.github.com>
This commit is contained in:
i509VCB 2020-07-10 04:59:25 -07:00 committed by GitHub
parent 017b5ce124
commit 283dee7b33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 6 deletions

View File

@ -11,3 +11,5 @@ CLASS net/minecraft/class_2966 net/minecraft/Bootstrap
METHOD method_12852 setOutputStreams ()V
METHOD method_17597 getMissingTranslations ()Ljava/util/Set;
METHOD method_17598 logMissing ()V
METHOD method_27732 collectMissingGameRuleTranslations (Ljava/util/Set;)V
ARG 0 translations

View File

@ -38,8 +38,11 @@ CLASS net/minecraft/class_1928 net/minecraft/world/GameRules
FIELD field_9197 RULE_TYPES Ljava/util/Map;
METHOD <init> (Ljava/util/Map;)V
ARG 1 rules
METHOD method_20744 forEachType (Lnet/minecraft/class_1928$class_4311;)V
ARG 0 action
METHOD method_20744 accept (Lnet/minecraft/class_1928$class_4311;)V
COMMENT Make the visitor visit all registered game rules.
COMMENT
COMMENT <p>The visitation involves calling both {@link #accept(GameRules.Key, GameRules.Type)} and {@code acceptX} for every game rule, where X is the current rule's concrete type such as a boolean.
ARG 0 visitor
METHOD method_20745 accept (Lnet/minecraft/class_1928$class_4311;Lnet/minecraft/class_1928$class_4313;Lnet/minecraft/class_1928$class_4314;)V
ARG 0 consumer
ARG 1 key
@ -104,14 +107,24 @@ CLASS net/minecraft/class_1928 net/minecraft/world/GameRules
METHOD method_20760 create (ZLjava/util/function/BiConsumer;)Lnet/minecraft/class_1928$class_4314;
ARG 0 initialValue
ARG 1 changeCallback
CLASS class_4311 TypeConsumer
METHOD method_20762 accept (Lnet/minecraft/class_1928$class_4313;Lnet/minecraft/class_1928$class_4314;)V
CLASS class_4311 Visitor
COMMENT A visitor used to visit all game rules.
METHOD method_20762 visit (Lnet/minecraft/class_1928$class_4313;Lnet/minecraft/class_1928$class_4314;)V
COMMENT Visit a game rule.
COMMENT
COMMENT <p>It is expected all game rules regardless of type will be visited using this method.
ARG 1 key
ARG 2 type
METHOD method_27329 acceptBoolean (Lnet/minecraft/class_1928$class_4313;Lnet/minecraft/class_1928$class_4314;)V
METHOD method_27329 visitBoolean (Lnet/minecraft/class_1928$class_4313;Lnet/minecraft/class_1928$class_4314;)V
COMMENT Visit a boolean rule.
COMMENT
COMMENT <p>Note {@link #accept(GameRules.Key, GameRules.Type)} will be called before this method.
ARG 1 key
ARG 2 type
METHOD method_27330 acceptInt (Lnet/minecraft/class_1928$class_4313;Lnet/minecraft/class_1928$class_4314;)V
METHOD method_27330 visitInt (Lnet/minecraft/class_1928$class_4313;Lnet/minecraft/class_1928$class_4314;)V
COMMENT Visit an integer rule.
COMMENT
COMMENT <p>Note {@link #accept(GameRules.Key, GameRules.Type)} will be called before this method.
ARG 1 key
ARG 2 type
CLASS class_4312 IntRule