Skip to content

Commit 26f35eb

Browse files
committed
13.4.1
1 parent baba417 commit 26f35eb

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/main/java/com/redlimerl/speedrunigt/mixins/timeline/ServerPlayerEntityMixin.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
package com.redlimerl.speedrunigt.mixins.timeline;
22

3-
import com.google.common.collect.Sets;
43
import com.mojang.authlib.GameProfile;
54
import com.redlimerl.speedrunigt.timer.InGameTimer;
65
import com.redlimerl.speedrunigt.timer.InGameTimerUtils;
76
import com.redlimerl.speedrunigt.timer.TimerStatus;
87
import com.redlimerl.speedrunigt.timer.category.RunCategories;
98
import net.minecraft.entity.Entity;
109
import net.minecraft.entity.player.PlayerEntity;
10+
import net.minecraft.item.ItemStack;
1111
import net.minecraft.item.Items;
1212
import net.minecraft.server.network.ServerPlayerEntity;
1313
import net.minecraft.server.world.ServerWorld;
14-
import net.minecraft.tag.SetTag;
1514
import net.minecraft.util.math.BlockPos;
1615
import net.minecraft.util.math.Vec3d;
1716
import 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

Comments
 (0)