Skip to content

Commit

Permalink
Fix anchor distance config option not working (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
xchgeax authored Jul 22, 2022
1 parent cf41b89 commit 37bc1d7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/crazypants/enderio/api/teleport/TravelSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import crazypants.enderio.EnderIO;
import crazypants.enderio.config.Config;
import crazypants.enderio.teleport.TravelController;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;

public enum TravelSource {
BLOCK() {
Expand Down Expand Up @@ -39,7 +42,15 @@ public static int getMaxDistance() {
}

public static int getMaxDistanceSq() {
return STAFF.getMaxDistanceTravelledSq();
EntityPlayer player = Minecraft.getMinecraft().thePlayer;

if (player == null) {
return 0;
}

return TravelController.instance.isTravelItemActive(player)
? TravelSource.STAFF.getMaxDistanceTravelledSq()
: TravelSource.BLOCK.getMaxDistanceTravelledSq();
}

public final String sound;
Expand Down

0 comments on commit 37bc1d7

Please sign in to comment.