Last active
September 6, 2015 01:48
-
-
Save tterrag1098/6156f364f5a3f70e7bfb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package crazypants.enderio.api.teleport; | |
import java.util.concurrent.Callable; | |
import com.google.common.util.concurrent.Callables; | |
import crazypants.enderio.EnderIO; | |
import crazypants.enderio.config.Config; | |
public enum TravelSource { | |
BLOCK(Callables.returning(0f), new Callable<Integer>() { | |
public Integer call() { | |
return Config.travelAnchorMaxDistance; | |
} | |
}), | |
STAFF(new Callable<Float>() { | |
public Float call() { | |
return Config.travelStaffPowerPerBlockRF; | |
} | |
}, new Callable<Integer>() { | |
public Integer call() { | |
return Config.travelStaffMaxDistance; | |
} | |
}), | |
STAFF_BLINK(new Callable<Float>() { | |
public Float call() { | |
return Config.travelStaffPowerPerBlockRF; | |
} | |
}, new Callable<Integer>() { | |
public Integer call() { | |
return Config.travelStaffMaxBlinkDistance; | |
} | |
}), | |
TELEPAD(Callables.returning(0f), Callables.returning(0), EnderIO.DOMAIN + ":telepad.teleport"); | |
public final Callable<Float> powerCostPerBlockTraveledRF; | |
public final Callable<Integer> maxDistanceTravelled; | |
public final Callable<Integer> maxDistanceTravelledSq; | |
public final String sound; | |
private TravelSource(Callable<Float> powerCostPerBlockTraveled, Callable<Integer> maxDistanceTravelled) { | |
this(powerCostPerBlockTraveled, maxDistanceTravelled, "mob.endermen.portal"); | |
} | |
private TravelSource(Callable<Float> powerCostPerBlockTraveled, Callable<Integer> maxDistanceTravelled, String sound) { | |
this.powerCostPerBlockTraveledRF = powerCostPerBlockTraveled; | |
this.maxDistanceTravelled = maxDistanceTravelled; | |
maxDistanceTravelledSq = new Callable<Integer>() { | |
public Integer call() throws Exception { | |
int dist = TravelSource.this.maxDistanceTravelled.call(); | |
return dist * dist; | |
} | |
}; | |
this.sound = sound; | |
} | |
public boolean getConserveMomentum() { | |
return this == STAFF_BLINK; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment