Some enchanced for loops are not enhanced.

Open
#16 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
compilers

Research direction

Start at NetHandlerPlayClient.func_191980_a in the decompiler output shown in the issue and compare the REMOVE and INIT iterator loops with the existing enhanced loops. Trace the corresponding decompiler handling for these loops, then verify that eligible iterator-based loops are emitted consistently without changing the method's behavior.

Written by the indexing model from the issue text.

Description

See 1.13, NetHandlerPlayClient.func_191980_a

    label57:
      switch(spacketrecipebook$state) {
      case REMOVE:
         Iterator iterator1 = p_191980_1_.func_192595_a().iterator();

         while(true) {
            if (!iterator1.hasNext()) {
               break label57;
            }

            ResourceLocation resourcelocation3 = (ResourceLocation)iterator1.next();
            IRecipe irecipe3 = this.field_199528_o.func_199517_a(resourcelocation3);
            if (irecipe3 != null) {
               recipebookclient.func_193831_b(irecipe3);
            }
         }
      case INIT:
         for(ResourceLocation resourcelocation1 : p_191980_1_.func_192595_a()) {
            IRecipe irecipe1 = this.field_199528_o.func_199517_a(resourcelocation1);
            if (irecipe1 != null) {
               recipebookclient.func_194073_a(irecipe1);
            }
         }

         Iterator iterator = p_191980_1_.func_193644_b().iterator();

         while(true) {
            if (!iterator.hasNext()) {
               break label57;
            }

            ResourceLocation resourcelocation2 = (ResourceLocation)iterator.next();
            IRecipe irecipe2 = this.field_199528_o.func_199517_a(resourcelocation2);
            if (irecipe2 != null) {
               recipebookclient.func_193825_e(irecipe2);
            }
         }
      case ADD:
         for(ResourceLocation resourcelocation : p_191980_1_.func_192595_a()) {
            IRecipe irecipe = this.field_199528_o.func_199517_a(resourcelocation);
            if (irecipe != null) {
               recipebookclient.func_194073_a(irecipe);
               recipebookclient.func_193825_e(irecipe);
               RecipeToast.func_193665_a(this.field_147299_f.func_193033_an(), irecipe);
            }
         }
      }

Dominant language
No language data
Stars
110
Forks
49
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MinecraftForge/ForgeFlower

All issues in MinecraftForge/ForgeFlower

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.