Skip to content

Commit

Permalink
A try at decompiling optifine
Browse files Browse the repository at this point in the history
  • Loading branch information
KnoxTheDev committed Dec 8, 2024
1 parent 4e03898 commit f2054c9
Show file tree
Hide file tree
Showing 113 changed files with 1,749 additions and 0 deletions.
Binary file added Tools.jar
Binary file not shown.
Empty file added decompiled.jar
Empty file.
Binary file added fart.jar
Binary file not shown.
11 changes: 11 additions & 0 deletions joined/com/mojang/blaze3d/font/TrueTypeGlyphProvider.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/com/mojang/blaze3d/font/TrueTypeGlyphProvider.java
+++ b/com/mojang/blaze3d/font/TrueTypeGlyphProvider.java
@@ -103,7 +103,7 @@
int k = ft_glyphslot.bitmap_top();
int l = ft_bitmap.width();
int i1 = ft_bitmap.rows();
- return (GlyphInfo)(l > 0 && i1 > 0 ? new TrueTypeGlyphProvider.Glyph((float)j, (float)k, l, i1, f, p_362974_) : () -> f / this.f_83839_);
+ return (GlyphInfo)(l > 0 && i1 > 0 ? new TrueTypeGlyphProvider.Glyph((float)j, (float)k, l, i1, f, p_362974_) : (GlyphInfo.SpaceGlyphInfo)() -> f / this.f_83839_);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsSelectWorldTemplateScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsSelectWorldTemplateScreen.java
@@ -76,10 +76,10 @@
this.f_167479_ = p_167486_;
this.f_89598_ = p_167487_;
if (p_167488_ == null) {
- this.f_302619_ = new RealmsSelectWorldTemplateScreen.WorldTemplateList(this);
+ this.f_302619_ = new RealmsSelectWorldTemplateScreen.WorldTemplateList();
this.m_89653_(new WorldTemplatePaginatedList(10));
} else {
- this.f_302619_ = new RealmsSelectWorldTemplateScreen.WorldTemplateList(this, Lists.newArrayList(p_167488_.f_87753_));
+ this.f_302619_ = new RealmsSelectWorldTemplateScreen.WorldTemplateList(Lists.newArrayList(p_167488_.f_87753_));
this.m_89653_(p_167488_);
}
}
@@ -91,7 +91,7 @@
@Override
public void m_7856_() {
this.f_291318_.m_324480_(this.f_96539_, this.f_96547_);
- this.f_302619_ = this.f_291318_.m_268999_(new RealmsSelectWorldTemplateScreen.WorldTemplateList(this, this.f_302619_.m_89818_()));
+ this.f_302619_ = this.f_291318_.m_268999_(new RealmsSelectWorldTemplateScreen.WorldTemplateList(this.f_302619_.m_89818_()));
LinearLayout linearlayout = this.f_291318_.m_269281_(LinearLayout.m_295847_().m_294554_(10));
linearlayout.m_294823_().m_264356_();
this.f_89616_ = linearlayout.m_264406_(Button.m_253074_(f_291283_, p_89701_ -> this.m_89738_()).m_252780_(100).m_253136_());
@@ -368,24 +368,23 @@

@OnlyIn(Dist.CLIENT)
class WorldTemplateList extends ObjectSelectionList<RealmsSelectWorldTemplateScreen.Entry> {
- public WorldTemplateList(final RealmsSelectWorldTemplateScreen param1) {
- this(var1, Collections.emptyList());
+ public WorldTemplateList() {
+ this(Collections.emptyList());
}

- public WorldTemplateList(final Iterable<WorldTemplate> param1, final Iterable p_89795_) {
- super(Minecraft.m_91087_(), var1.f_96543_, var1.f_96544_ - 33 - var1.m_294786_(), var1.m_294786_(), 46);
- this.f_303630_ = var1;
+ public WorldTemplateList(final Iterable<WorldTemplate> p_89795_) {
+ super(Minecraft.m_91087_(), RealmsSelectWorldTemplateScreen.this.f_96543_, RealmsSelectWorldTemplateScreen.this.f_96544_ - 33 - RealmsSelectWorldTemplateScreen.this.m_294786_(), RealmsSelectWorldTemplateScreen.this.m_294786_(), 46);
p_89795_.forEach(this::m_89804_);
}

public void m_89804_(WorldTemplate p_89805_) {
- this.m_7085_(this.f_303630_.new Entry(p_89805_));
+ this.m_7085_(RealmsSelectWorldTemplateScreen.this.new Entry(p_89805_));
}

@Override
public boolean m_6375_(double p_89797_, double p_89798_, int p_89799_) {
- if (this.f_303630_.f_89597_ != null) {
- ConfirmLinkScreen.m_274480_(this.f_303630_, this.f_303630_.f_89597_);
+ if (RealmsSelectWorldTemplateScreen.this.f_89597_ != null) {
+ ConfirmLinkScreen.m_274480_(RealmsSelectWorldTemplateScreen.this, RealmsSelectWorldTemplateScreen.this.f_89597_);
return true;
} else {
return super.m_6375_(p_89797_, p_89798_, p_89799_);
@@ -394,8 +393,8 @@

public void m_6987_(@Nullable RealmsSelectWorldTemplateScreen.Entry p_89807_) {
super.m_6987_(p_89807_);
- this.f_303630_.f_89613_ = p_89807_ == null ? null : p_89807_.f_89750_;
- this.f_303630_.m_89718_();
+ RealmsSelectWorldTemplateScreen.this.f_89613_ = p_89807_ == null ? null : p_89807_.f_89750_;
+ RealmsSelectWorldTemplateScreen.this.m_89718_();
}

@Override
11 changes: 11 additions & 0 deletions joined/net/minecraft/TracingExecutor.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/net/minecraft/TracingExecutor.java
+++ b/net/minecraft/TracingExecutor.java
@@ -21,7 +21,7 @@
}
});
} else {
- return (Executor)(TracyClient.isAvailable() ? p_366279_ -> this.f_347685_.execute(() -> {
+ return (TracyClient.isAvailable() ? p_366279_ -> this.f_347685_.execute(() -> {
try (Zone zone = TracyClient.beginZone(p_364709_, SharedConstants.f_136183_)) {
p_366279_.run();
}
11 changes: 11 additions & 0 deletions joined/net/minecraft/Util.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/net/minecraft/Util.java
+++ b/net/minecraft/Util.java
@@ -563,7 +563,7 @@
public static <K extends Enum<K>, V> EnumMap<K, V> m_356390_(Class<K> p_361919_, Function<K, V> p_363082_) {
EnumMap<K, V> enummap = new EnumMap<>(p_361919_);

- for (K k : (Enum[])p_361919_.getEnumConstants()) {
+ for (K k : p_361919_.getEnumConstants()) {
enummap.put(k, p_363082_.apply(k));
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/net/minecraft/advancements/critereon/EntitySubPredicates.java
+++ b/net/minecraft/advancements/critereon/EntitySubPredicates.java
@@ -179,7 +179,7 @@
this.f_315554_ = p_329584_;
this.f_314467_ = RecordCodecBuilder.mapCodec(
p_330908_ -> p_330908_.group(RegistryCodecs.m_206277_(p_332702_).fieldOf("variant").forGetter(p_329421_ -> p_329421_.f_314024_))
- .apply(p_330908_, p_331166_ -> new EntitySubPredicates.EntityHolderVariantPredicateType.Instance(p_331166_))
+ .apply(p_330908_, p_331166_ -> new EntitySubPredicates.EntityHolderVariantPredicateType<V>.Instance(p_331166_))
);
}

@@ -222,7 +222,7 @@
this.f_314447_ = p_333059_;
this.f_314924_ = RecordCodecBuilder.mapCodec(
p_330838_ -> p_330838_.group(p_329553_.fieldOf("variant").forGetter(p_332763_ -> p_332763_.f_316369_))
- .apply(p_330838_, p_327954_ -> new EntitySubPredicates.EntityVariantPredicateType.Instance(p_327954_))
+ .apply(p_330838_, p_327954_ -> new EntitySubPredicates.EntityVariantPredicateType<V>.Instance(p_327954_))
);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/net/minecraft/advancements/critereon/MinMaxBounds.java
+++ b/net/minecraft/advancements/critereon/MinMaxBounds.java
@@ -128,7 +128,7 @@
public static record Doubles(Optional<Double> f_290567_, Optional<Double> f_291623_, Optional<Double> f_154780_, Optional<Double> f_154781_)
implements MinMaxBounds<Double> {
public static final MinMaxBounds.Doubles f_154779_ = new MinMaxBounds.Doubles(Optional.empty(), Optional.empty());
- public static final Codec<MinMaxBounds.Doubles> f_290947_ = MinMaxBounds.m_294160_(Codec.DOUBLE, MinMaxBounds.Doubles::new);
+ public static final Codec<MinMaxBounds.Doubles> f_290947_ = MinMaxBounds.<Double, Doubles>m_294160_(Codec.DOUBLE, MinMaxBounds.Doubles::new);

private Doubles(Optional<Double> p_299492_, Optional<Double> p_300933_) {
this(p_299492_, p_300933_, m_154802_(p_299492_), m_154802_(p_300933_));
@@ -194,7 +194,7 @@
public static record Ints(Optional<Integer> f_290888_, Optional<Integer> f_291545_, Optional<Long> f_55365_, Optional<Long> f_55366_)
implements MinMaxBounds<Integer> {
public static final MinMaxBounds.Ints f_55364_ = new MinMaxBounds.Ints(Optional.empty(), Optional.empty());
- public static final Codec<MinMaxBounds.Ints> f_290636_ = MinMaxBounds.m_294160_(Codec.INT, MinMaxBounds.Ints::new);
+ public static final Codec<MinMaxBounds.Ints> f_290636_ = MinMaxBounds.<Integer, Ints>m_294160_(Codec.INT, MinMaxBounds.Ints::new);

private Ints(Optional<Integer> p_299979_, Optional<Integer> p_297344_) {
this(p_299979_, p_297344_, p_299979_.map(p_296140_ -> p_296140_.longValue() * p_296140_.longValue()), m_55384_(p_297344_));
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- a/net/minecraft/advancements/critereon/PlayerPredicate.java
+++ b/net/minecraft/advancements/critereon/PlayerPredicate.java
@@ -245,11 +245,11 @@
private static <T> MapCodec<PlayerPredicate.StatMatcher<T>> m_293532_(StatType<T> p_297243_) {
return RecordCodecBuilder.mapCodec(
p_325241_ -> p_325241_.group(
- (App<Mu<? extends PlayerPredicate.StatMatcher<?>>, Holder<T>>)p_297243_.m_12893_()
+ p_297243_.m_12893_()
.m_206110_()
.fieldOf("stat")
.forGetter(PlayerPredicate.StatMatcher::f_291891_),
- (App<Mu<? extends PlayerPredicate.StatMatcher<?>>, MinMaxBounds.Ints>)MinMaxBounds.Ints.f_290636_
+ MinMaxBounds.Ints.f_290636_
.optionalFieldOf("value", MinMaxBounds.Ints.f_55364_)
.forGetter(PlayerPredicate.StatMatcher::f_291204_)
)
19 changes: 19 additions & 0 deletions joined/net/minecraft/client/Minecraft.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -2201,6 +2201,7 @@
case EntityHitResult entityhitresult:
this.f_91072_.m_374389_(entityhitresult.m_82443_(), flag);
break;
+ default:
}
}
}
@@ -2295,7 +2296,7 @@
}

public CompletableFuture<Void> m_91088_() {
- return this.m_18691_(this::m_91391_).thenCompose(p_231391_ -> (CompletionStage<Void>)p_231391_);
+ return this.m_18691_((Supplier<CompletableFuture<Void>>)this::m_91391_).thenCompose(p_231391_ -> (CompletionStage<Void>)p_231391_);
}

public void m_239476_(ReportEnvironment p_239477_) {
96 changes: 96 additions & 0 deletions joined/net/minecraft/client/gui/Font.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
--- a/net/minecraft/client/gui/Font.java
+++ b/net/minecraft/client/gui/Font.java
@@ -142,7 +142,7 @@
) {
int i = m_92719_(p_168650_);
Font.StringRenderOutput font$stringrenderoutput = new Font.StringRenderOutput(
- this, p_168652_, 0.0F, 0.0F, i, false, p_254170_, Font.DisplayMode.NORMAL, p_168653_
+ p_168652_, 0.0F, 0.0F, i, false, p_254170_, Font.DisplayMode.NORMAL, p_168653_
);

for (int j = -1; j <= 1; j++) {
@@ -166,7 +166,7 @@

font$stringrenderoutput.m_352913_();
Font.StringRenderOutput font$stringrenderoutput1 = new Font.StringRenderOutput(
- this, p_168652_, p_168647_, p_168648_, m_92719_(p_168649_), false, p_254170_, Font.DisplayMode.POLYGON_OFFSET, p_168653_
+ p_168652_, p_168647_, p_168648_, m_92719_(p_168649_), false, p_254170_, Font.DisplayMode.POLYGON_OFFSET, p_168653_
);
p_168646_.m_13731_(font$stringrenderoutput1);
font$stringrenderoutput1.m_92961_(p_168647_);
@@ -226,7 +226,7 @@
boolean p_369545_
) {
Font.StringRenderOutput font$stringrenderoutput = new Font.StringRenderOutput(
- this, p_272595_, p_273532_, p_272783_, p_273217_, p_273727_, p_273583_, p_272734_, p_273610_, p_273199_, p_369545_
+ p_272595_, p_273532_, p_272783_, p_273217_, p_273727_, p_273583_, p_272734_, p_273610_, p_273199_, p_369545_
);
StringDecomposer.m_14346_(p_273765_, Style.f_131099_, font$stringrenderoutput);
return font$stringrenderoutput.m_92961_(p_273532_);
@@ -246,7 +246,7 @@
boolean p_365371_
) {
Font.StringRenderOutput font$stringrenderoutput = new Font.StringRenderOutput(
- this, p_273392_, p_272632_, p_273541_, p_273200_, p_273774_, p_273312_, p_273276_, p_272625_, p_273371_, p_365371_
+ p_273392_, p_272632_, p_273541_, p_273200_, p_273774_, p_273312_, p_273276_, p_272625_, p_273371_, p_365371_
);
p_273322_.m_13731_(font$stringrenderoutput);
return font$stringrenderoutput.m_92961_(p_272632_);
@@ -328,7 +328,6 @@
}

public StringRenderOutput(
- final Font param1,
final MultiBufferSource p_181365_,
final float p_181366_,
final float p_181367_,
@@ -338,11 +337,10 @@
final Font.DisplayMode p_181371_,
final int p_181372_
) {
- this(var1, p_181365_, p_181366_, p_181367_, p_181368_, 0, p_181369_, p_254510_, p_181371_, p_181372_, true);
+ this(p_181365_, p_181366_, p_181367_, p_181368_, 0, p_181369_, p_254510_, p_181371_, p_181372_, true);
}

public StringRenderOutput(
- final Font param1,
final MultiBufferSource p_369661_,
final float p_364376_,
final float p_367232_,
@@ -354,7 +352,6 @@
final int p_361543_,
final boolean p_363799_
) {
- this.f_92938_ = var1;
this.f_347105_ = new ArrayList<>();
this.f_92937_ = p_369661_;
this.f_92948_ = p_364376_;
@@ -370,8 +367,8 @@

@Override
public boolean m_6411_(int p_92967_, Style p_92968_, int p_92969_) {
- FontSet fontset = this.f_92938_.m_92863_(p_92968_.m_131192_());
- GlyphInfo glyphinfo = fontset.m_243128_(p_92969_, this.f_92938_.f_242994_);
+ FontSet fontset = Font.this.m_92863_(p_92968_.m_131192_());
+ GlyphInfo glyphinfo = fontset.m_243128_(p_92969_, Font.this.f_242994_);
BakedGlyph bakedglyph = p_92968_.m_131176_() && p_92969_ != 32 ? fontset.m_95067_(glyphinfo) : fontset.m_95078_(p_92969_);
boolean flag = p_92968_.m_131154_();
TextColor textcolor = p_92968_.m_131135_();
@@ -403,7 +400,7 @@
BakedGlyph.Effect bakedglyph$effect = new BakedGlyph.Effect(
p_92963_ - 1.0F, this.f_92949_ + 9.0F, this.f_92948_, this.f_92949_ - 1.0F, this.m_352635_(), this.f_347276_
);
- bakedglyph = this.f_92938_.m_92863_(Style.f_131100_).m_95064_();
+ bakedglyph = Font.this.m_92863_(Style.f_131100_).m_95064_();
VertexConsumer vertexconsumer = this.f_92937_.m_6299_(bakedglyph.m_181387_(this.f_181362_));
bakedglyph.m_95220_(bakedglyph$effect, this.f_92945_, vertexconsumer, this.f_92947_);
}
@@ -411,7 +408,7 @@
this.m_352913_();
if (this.f_92950_ != null) {
if (bakedglyph == null) {
- bakedglyph = this.f_92938_.m_92863_(Style.f_131100_).m_95064_();
+ bakedglyph = Font.this.m_92863_(Style.f_131100_).m_95064_();
}

VertexConsumer vertexconsumer1 = this.f_92937_.m_6299_(bakedglyph.m_181387_(this.f_181362_));
11 changes: 11 additions & 0 deletions joined/net/minecraft/client/gui/font/FontSet.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/font/FontSet.java
+++ b/net/minecraft/client/gui/font/FontSet.java
@@ -81,7 +81,7 @@
}

Set<GlyphProvider> set = Sets.newHashSet();
- intset.forEach(p_232561_ -> {
+ intset.forEach((int p_232561_) -> {
for (GlyphProvider glyphprovider : list) {
GlyphInfo glyphinfo = glyphprovider.m_214022_(p_232561_);
if (glyphinfo != null) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/PresetFlatWorldScreen.java
+++ b/net/minecraft/client/gui/screens/PresetFlatWorldScreen.java
@@ -299,7 +299,7 @@
public Entry(final Holder<FlatLevelGeneratorPreset> p_232758_) {
this.f_169357_ = p_232758_.m_203334_();
this.f_232755_ = p_232758_.m_203543_()
- .map(p_232760_ -> Component.m_237115_(p_232760_.m_135782_().m_214296_("flat_world_preset")))
+ .map(p_232760_ -> (Component)Component.m_237115_(p_232760_.m_135782_().m_214296_("flat_world_preset")))
.orElse(PresetFlatWorldScreen.f_232751_);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/inventory/BookViewScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/BookViewScreen.java
@@ -262,7 +262,7 @@
} else {
WritableBookContent writablebookcontent = p_98309_.m_323252_(DataComponents.f_314472_);
return writablebookcontent != null
- ? new BookViewScreen.BookAccess(writablebookcontent.m_320046_(flag).map(Component::m_237113_).toList())
+ ? new BookViewScreen.BookAccess(writablebookcontent.m_320046_(flag).map(Component::m_237113_).map(Component.class::cast).toList())
: null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/screens/recipebook/CraftingRecipeBookComponent.java
+++ b/net/minecraft/client/gui/screens/recipebook/CraftingRecipeBookComponent.java
@@ -87,6 +87,7 @@
}
break label15;
}
+ default:
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/screens/recipebook/OverlayRecipeComponent.java
+++ b/net/minecraft/client/gui/screens/recipebook/OverlayRecipeComponent.java
@@ -225,6 +225,7 @@
}
break label19;
}
+ default:
}

return list;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
@@ -314,7 +314,7 @@
public Component m_267572_() {
return Optional.ofNullable(this.f_267398_)
.flatMap(Holder::m_203543_)
- .map(p_268048_ -> Component.m_237115_(p_268048_.m_135782_().m_214296_("generator")))
+ .map(p_268048_ -> (Component)Component.m_237115_(p_268048_.m_135782_().m_214296_("generator")))
.orElse(f_267418_);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
@@ -156,7 +156,7 @@
record Data(LevelSettings f_244166_, WorldOptions f_244534_, Registry<LevelStem> f_244151_) {
}

- return this.m_246486_(
+ return this.<Data, Pair<LevelSettings, WorldCreationContext>>m_246486_(
worldloader$packconfig,
p_357766_ -> {
Registry<LevelStem> registry = new MappedRegistry<>(Registries.f_256862_, Lifecycle.stable()).m_203521_();
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/spectator/categories/TeleportToPlayerMenuCategory.java
+++ b/net/minecraft/client/gui/spectator/categories/TeleportToPlayerMenuCategory.java
@@ -34,7 +34,7 @@
this.f_101857_ = p_101861_.stream()
.filter(p_253336_ -> p_253336_.m_105325_() != GameType.SPECTATOR)
.sorted(f_101854_)
- .map(p_253334_ -> new PlayerMenuItem(p_253334_.m_105312_()))
+ .map(p_253334_ -> (SpectatorMenuItem)new PlayerMenuItem(p_253334_.m_105312_()))
.toList();
}

18 changes: 18 additions & 0 deletions joined/net/minecraft/client/multiplayer/ClientLevel.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- a/net/minecraft/client/multiplayer/ClientLevel.java
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
@@ -1082,6 +1082,7 @@
case EnderDragon enderdragon:
ClientLevel.this.f_371413_.addAll(Arrays.asList(enderdragon.m_31156_()));
break;
+ default:
}
}

@@ -1095,6 +1096,7 @@
case EnderDragon enderdragon:
ClientLevel.this.f_371413_.removeAll(Arrays.asList(enderdragon.m_31156_()));
break;
+ default:
}
}

Loading

0 comments on commit f2054c9

Please sign in to comment.