Fixed the teleporter cost being 3 times to much

This commit is contained in:
Michael Hillcox 2020-11-29 14:28:30 +00:00
parent 0a036ee1ef
commit 9ca86b2937
No known key found for this signature in database
GPG key ID: 971C5B254742488F

View file

@ -37,7 +37,7 @@ public class TeleportStaffItem extends CrystalFluxItem {
Vector3f centerOfHit = new Vector3f(toPos.getX(), toPos.getY(), toPos.getZ());
centerOfHit.add(.5f, (blockTrace.getFace().getAxis() == Direction.Axis.Y ? .5f : 0), .5f);
int energyCost = BASE_COST_PER_USE + (int) (BASE_COST_PER_USE * player.getDistanceSq(toPos.getX(), toPos.getY(), toPos.getZ()));
int energyCost = BASE_COST_PER_USE + (int) (BASE_COST_PER_USE * (player.getDistanceSq(toPos.getX(), toPos.getY(), toPos.getZ()) / 100));
boolean canUse = stack.getCapability(CapabilityEnergy.ENERGY).map(e -> e.getEnergyStored() >= energyCost).orElse(false);
if (!canUse) {