MinecraftForge / ForgeFlower

Forge's modifications to FernFlower. Fixing various bugs/inconsistencies. Main Repo: https://github.com/MinecraftForge/FernFlower
Apache License 2.0
80 stars 44 forks source link

Record Canonical Constructor's not cleaned/written correctly. #108

Closed LexManos closed 2 years ago

LexManos commented 2 years ago

1.18.1, net.minecraft.world.ticks.ScheduledTick, has a canonical constructor that makes the position immutible. This causes issues with eclipe's compiler due to ambiguous constructors. {Honestly I think this is a issue in eclipse compiler but it's also an issue with us} Current decompile

   public ScheduledTick(T p_193383_, BlockPos p_193384_, long p_193385_, long p_193386_) {
      this(p_193383_, p_193384_, p_193385_, TickPriority.NORMAL, p_193386_);
   }

   public ScheduledTick(T type, BlockPos pos, long triggerTick, TickPriority priority, long subTickOrder) {
      pos = pos.immutable();
      this.type = type;
      this.pos = pos;
      this.triggerTick = triggerTick;
      this.priority = priority;
      this.subTickOrder = subTickOrder;
   }

Proper decompile:

   public ScheduledTick(T p_193383_, BlockPos p_193384_, long p_193385_, long p_193386_) {
      this(p_193383_, p_193384_, p_193385_, TickPriority.NORMAL, p_193386_);
   }

   public ScheduledTick {
      pos = pos.immutable();
   }

See: https://docs.oracle.com/en/java/javase/15/language/records.html#GUID-6699E26F-4A9B-4393-A08B-1E47D4B2D263__GUID-0630D05B-DCF5-484D-8D46-A78DB6C8B2F0