diff --git a/src/main/java/crazypants/enderio/teleport/TravelController.java b/src/main/java/crazypants/enderio/teleport/TravelController.java index 6543b4095d..0110543f12 100644 --- a/src/main/java/crazypants/enderio/teleport/TravelController.java +++ b/src/main/java/crazypants/enderio/teleport/TravelController.java @@ -120,7 +120,8 @@ public String validatePacketTravelEvent(EntityPlayerMP toTp, int x, int y, int z double dist = getDistanceSquared(toTp, target); // allow 15% overshoot to account for rounding if (dist * 100 > source.getMaxDistanceTravelledSq() * 115) return "dist check fail"; - if (getRequiredPower(toTp, source, target) > powerUse) return "power use to little"; + // allow 4 blocks of c/s player pos desync + if (getPower(toTp, source, target, -4F) > powerUse) return "power use too little"; ItemStack equippedItem = toTp.getCurrentEquippedItem(); switch (source) { case TELEPAD: @@ -674,7 +675,7 @@ public int getRequiredPower(EntityPlayer player, TravelSource source, BlockCoord } int requiredPower; ItemStack staff = player.getCurrentEquippedItem(); - requiredPower = (int) (getDistance(player, coord) * source.getPowerCostPerBlockTraveledRF()); + requiredPower = getPower(player, source, coord, 0F); int canUsePower = getEnergyInTravelItem(staff); if (requiredPower > canUsePower) { // make sure chat is sent only once per trial @@ -687,6 +688,10 @@ public int getRequiredPower(EntityPlayer player, TravelSource source, BlockCoord return requiredPower; } + private int getPower(EntityPlayer player, TravelSource source, BlockCoord coord, float distanceWavier) { + return (int) ((getDistance(player, coord) + distanceWavier) * source.getPowerCostPerBlockTraveledRF()); + } + private boolean isInRangeTarget(EntityPlayer player, BlockCoord bc, float maxSq) { return getDistanceSquared(player, bc) <= maxSq; }