11package com .redlimerl .speedrunigt .mixins .timeline ;
22
3- import com .google .common .collect .Sets ;
43import com .mojang .authlib .GameProfile ;
54import com .redlimerl .speedrunigt .timer .InGameTimer ;
65import com .redlimerl .speedrunigt .timer .InGameTimerUtils ;
76import com .redlimerl .speedrunigt .timer .TimerStatus ;
87import com .redlimerl .speedrunigt .timer .category .RunCategories ;
98import net .minecraft .entity .Entity ;
109import net .minecraft .entity .player .PlayerEntity ;
10+ import net .minecraft .item .ItemStack ;
1111import net .minecraft .item .Items ;
1212import net .minecraft .server .network .ServerPlayerEntity ;
1313import net .minecraft .server .world .ServerWorld ;
14- import net .minecraft .tag .SetTag ;
1514import net .minecraft .util .math .BlockPos ;
1615import net .minecraft .util .math .Vec3d ;
1716import net .minecraft .util .registry .RegistryKey ;
@@ -54,8 +53,7 @@ public void onChangedDimension(ServerWorld destination, CallbackInfoReturnable<E
5453 }
5554
5655 if (oldRegistryKey == World .NETHER && newRegistryKey == World .OVERWORLD ) {
57- if (this .inventory .contains (SetTag .method_29900 (Sets .newHashSet (Items .ENDER_EYE ))) ||
58- (this .inventory .contains (SetTag .method_29900 (Sets .newHashSet (Items .ENDER_PEARL ))) && this .inventory .containsAny (Sets .newHashSet (Items .BLAZE_POWDER , Items .BLAZE_ROD )))) {
56+ if (this .isEnoughTravel ()) {
5957 int portalIndex = InGameTimerUtils .isBlindTraveled (lastPortalPos );
6058 InGameTimer .getInstance ().tryInsertNewTimeline ("nether_travel" );
6159 if (portalIndex == 0 ) {
@@ -69,4 +67,17 @@ public void onChangedDimension(ServerWorld destination, CallbackInfoReturnable<E
6967 }
7068 }
7169 }
70+
71+ private boolean isEnoughTravel () {
72+ boolean eye = false , pearl = false , rod = false ;
73+ for (ItemStack itemStack : this .inventory .main ) {
74+ if (itemStack != null ) {
75+ if (itemStack .getItem () == Items .ENDER_EYE ) eye = true ;
76+ if (itemStack .getItem () == Items .ENDER_PEARL ) pearl = true ;
77+ if (itemStack .getItem () == Items .BLAZE_POWDER || itemStack .getItem () == Items .BLAZE_ROD ) rod = true ;
78+ }
79+ }
80+
81+ return eye || (pearl && rod );
82+ }
7283}
0 commit comments