From 283dee7b3335e625e8e239f07ff682f228747233 Mon Sep 17 00:00:00 2001 From: i509VCB Date: Fri, 10 Jul 2020 04:59:25 -0700 Subject: [PATCH] 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 * Update mappings/net/minecraft/world/GameRules.mapping Co-authored-by: shartte Co-authored-by: shartte --- mappings/net/minecraft/Bootstrap.mapping | 2 ++ .../net/minecraft/world/GameRules.mapping | 25 ++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/mappings/net/minecraft/Bootstrap.mapping b/mappings/net/minecraft/Bootstrap.mapping index 87e61e6fa6..cfcfda59e8 100644 --- a/mappings/net/minecraft/Bootstrap.mapping +++ b/mappings/net/minecraft/Bootstrap.mapping @@ -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 diff --git a/mappings/net/minecraft/world/GameRules.mapping b/mappings/net/minecraft/world/GameRules.mapping index 8722d0221b..2f1bd0876e 100644 --- a/mappings/net/minecraft/world/GameRules.mapping +++ b/mappings/net/minecraft/world/GameRules.mapping @@ -38,8 +38,11 @@ CLASS net/minecraft/class_1928 net/minecraft/world/GameRules FIELD field_9197 RULE_TYPES Ljava/util/Map; METHOD (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

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

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

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

Note {@link #accept(GameRules.Key, GameRules.Type)} will be called before this method. ARG 1 key ARG 2 type CLASS class_4312 IntRule